aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-09-10 17:00:27 +0200
committerGitHub <[email protected]>2017-09-10 17:00:27 +0200
commitbd855a931c76f31b19d562fd8732f1020744f7cc (patch)
tree51dfa7e57b0ad948719aeb3b4b27387f2fc27939
parent1af914c8b8d56d8be973189168d0f990e2a5f00c (diff)
parent92dd24450dc3795b25bfbcbc767d6e52498d92c7 (diff)
downloadmastodon.py-bd855a931c76f31b19d562fd8732f1020744f7cc.tar.gz
Merge pull request #83 from codl/1.1.0-fix-log-in
fix exception in log_in, by accepting json dates as timestamps
-rw-r--r--mastodon/Mastodon.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index ed8901c..d427444 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -973,7 +973,10 @@ class Mastodon:
973 for k, v in json_object.items(): 973 for k, v in json_object.items():
974 if k in known_date_fields: 974 if k in known_date_fields:
975 try: 975 try:
976 json_object[k] = dateutil.parser.parse(v) 976 if isinstance(v, int):
977 json_object[k] = datetime.datetime.fromtimestamp(v, pytz.utc)
978 else:
979 json_object[k] = dateutil.parser.parse(v)
977 except: 980 except:
978 raise MastodonAPIError('Encountered invalid date.') 981 raise MastodonAPIError('Encountered invalid date.')
979 return json_object 982 return json_object
Powered by cgit v1.2.3 (git 2.41.0)