diff options
author | Lorenz Diener <[email protected]> | 2017-11-24 13:59:13 +0100 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2017-11-24 13:59:50 +0100 |
commit | de2114b92b1d9dd67935fb3be96bce73576ceaea (patch) | |
tree | 38b9ce4951bd8b70e3fb298e83b68a35c6411ebe /mastodon/Mastodon.py | |
parent | 8987590545861c3963bdfe7f979e6dc2e9c89fdb (diff) | |
download | mastodon.py-de2114b92b1d9dd67935fb3be96bce73576ceaea.tar.gz |
BREAKING: Make streaming use json hooks
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r-- | mastodon/Mastodon.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index b4d4aa3..ab0071b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -1083,8 +1083,8 @@ class Mastodon: | |||
1083 | 1083 | ||
1084 | return (date_time_utc - epoch_utc).total_seconds() | 1084 | return (date_time_utc - epoch_utc).total_seconds() |
1085 | 1085 | ||
1086 | 1086 | @staticmethod | |
1087 | def __json_date_parse(self, json_object): | 1087 | def __json_date_parse(json_object): |
1088 | """ | 1088 | """ |
1089 | Parse dates in certain known json fields, if possible. | 1089 | Parse dates in certain known json fields, if possible. |
1090 | """ | 1090 | """ |
@@ -1100,7 +1100,8 @@ class Mastodon: | |||
1100 | raise MastodonAPIError('Encountered invalid date.') | 1100 | raise MastodonAPIError('Encountered invalid date.') |
1101 | return json_object | 1101 | return json_object |
1102 | 1102 | ||
1103 | def __json_id_to_bignum(self, json_object): | 1103 | @staticmethod |
1104 | def __json_id_to_bignum(json_object): | ||
1104 | """ | 1105 | """ |
1105 | Converts json string IDs to native python bignums. | 1106 | Converts json string IDs to native python bignums. |
1106 | """ | 1107 | """ |
@@ -1117,10 +1118,11 @@ class Mastodon: | |||
1117 | pass | 1118 | pass |
1118 | 1119 | ||
1119 | return json_object | 1120 | return json_object |
1120 | 1121 | ||
1121 | def __json_hooks(self, json_object): | 1122 | @staticmethod |
1122 | json_object = self.__json_date_parse(json_object) | 1123 | def __json_hooks(json_object): |
1123 | json_object = self.__json_id_to_bignum(json_object) | 1124 | json_object = Mastodon.__json_date_parse(json_object) |
1125 | json_object = Mastodon.__json_id_to_bignum(json_object) | ||
1124 | return json_object | 1126 | return json_object |
1125 | 1127 | ||
1126 | def __api_request(self, method, endpoint, params={}, files={}, do_ratelimiting=True): | 1128 | def __api_request(self, method, endpoint, params={}, files={}, do_ratelimiting=True): |