diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ecfd779 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018-2019 FAELIX (Faelix Limited) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/fulcrmpy/__init__.py b/fulcrmpy/__init__.py index e69de29..aba6e7f 100644 --- a/fulcrmpy/__init__.py +++ b/fulcrmpy/__init__.py @@ -0,0 +1,16 @@ + +import pytz +import datetime + +def string_to_datetime( s ): + if s is None: + return None + try: + return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.%fZ" ).replace( tzinfo = pytc.utc ) + except ValueError: + return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" ).replace( tzinfo = pytc.utc ) + +def datetime_to_string( dt ): + if dt is None: + return None + return dt.astimezone( pytz.utc ).strftime( "%Y-%m-%dT%H:%M:%S.%fZ" ) diff --git a/setup.py b/setup.py index e69de29..a81066d 100644 --- a/setup.py +++ b/setup.py @@ -0,0 +1,28 @@ +# depends upon: +# - requests +# - pytz +# - json + +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="fulcrmpy", + version="0.0.1", + author="Marek Isalski", + author_email="fulcrmpy.pypi@maz.nu", + description="Python bindings for fulcrm - https://fulcrm.org/", + long_description=long_description, + long_description_content_type="text/markdown", + install_requires=['requests>=2.21.0','pytz','json>=2.0.9'] + url="https://gitea.faelix.net/FAELIX/fulcrmpy", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], +) +