Skip to content

Commit

Permalink
py3.6 support fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyTempel committed Apr 1, 2020
1 parent ee76b62 commit b7d998a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion corona/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "0.0.1"
VERSION = "0.0.2"
__version__ = VERSION
__license__ = "MIT"
__author__ = "NANI"
Expand Down
6 changes: 5 additions & 1 deletion corona/objects.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import abc
import sys
from datetime import datetime, timezone

ASCII_LOWER = "abcdefghijklmnopqrstuvwxyz0123456789"
OFFSET = 127397

DATE_ISOFRMT36 = sys.version.startswith("3.6")


class Country:
def __init__(self, country_name, **data):
Expand Down Expand Up @@ -84,7 +87,8 @@ def __init__(self, **data):
class JHUCSSE(CountryProvinceHead):
def __init__(self, **data):
super().__init__(**data)
self.updated_at = datetime.fromisoformat(data.get('updatedAt')) # type: datetime
self.updated_at = datetime.strptime(data.get('updatedAt'), "%Y-%m-%d %H:%M:%S") if DATE_ISOFRMT36 else \
datetime.fromisoformat(data.get('updatedAt')) # type: datetime
stats = data.get('stats')
self.confirmed = stats.get('confirmed') # type: int
self.deaths = stats.get('deaths') # type: int
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name='corona.py',
packages=['corona'],
version='0.0.1',
version='0.0.2',
license='MIT',
description='An asynchronous wrapper for the corona.lmao.ninja API written in Python with Discord.py plugin.',
long_description=long_desc,
Expand Down

0 comments on commit b7d998a

Please sign in to comment.