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,6 +973,9 @@ class Mastodon:
|
||||||
for k, v in json_object.items():
|
for k, v in json_object.items():
|
||||||
if k in known_date_fields:
|
if k in known_date_fields:
|
||||||
try:
|
try:
|
||||||
|
if isinstance(v, int):
|
||||||
|
json_object[k] = datetime.datetime.fromtimestamp(v, pytz.utc)
|
||||||
|
else:
|
||||||
json_object[k] = dateutil.parser.parse(v)
|
json_object[k] = dateutil.parser.parse(v)
|
||||||
except:
|
except:
|
||||||
raise MastodonAPIError('Encountered invalid date.')
|
raise MastodonAPIError('Encountered invalid date.')
|
||||||
|
|
Loading…
Referencia en una nova incidència