We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e57d59 commit 6390ad1Copy full SHA for 6390ad1
pirate_weather/base.py
@@ -30,12 +30,13 @@ class AutoInit:
30
def __init__(self, **params):
31
try:
32
timezone = pytz.timezone(params.pop("timezone", None))
33
- except (pytz.UnknownTimeZoneError, AttributeError):
+ except (pytz.UnknownTimeZoneError, AttributeError, TypeError):
34
timezone = pytz.UTC
35
36
- for field in self.__annotations__:
+ for field in getattr(self.__class__, '__annotations__', {}):
37
api_field = undo_snake_case_key(field)
38
- if self.__annotations__[field] == datetime:
+ annotations = getattr(self.__class__, '__annotations__', {})
39
+ if annotations.get(field) == datetime:
40
params[api_field] = get_datetime_from_unix(
41
params.get(api_field), timezone
42
)
0 commit comments