Merge pull request #83 from codl/1.1.0-fix-log-in
fix exception in log_in, by accepting json dates as timestamps
This commit is contained in:
commit
bd855a931c
S'han modificat 1 arxius amb 4 adicions i 1 eliminacions
|
@ -973,7 +973,10 @@ class Mastodon:
|
|||
for k, v in json_object.items():
|
||||
if k in known_date_fields:
|
||||
try:
|
||||
json_object[k] = dateutil.parser.parse(v)
|
||||
if isinstance(v, int):
|
||||
json_object[k] = datetime.datetime.fromtimestamp(v, pytz.utc)
|
||||
else:
|
||||
json_object[k] = dateutil.parser.parse(v)
|
||||
except:
|
||||
raise MastodonAPIError('Encountered invalid date.')
|
||||
return json_object
|
||||
|
|
Loading…
Referencia en una nova incidència