diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 88f4906..c4e50f3 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -17,6 +17,7 @@ import re | |||
17 | import copy | 17 | import copy |
18 | import threading | 18 | import threading |
19 | import sys | 19 | import sys |
20 | import six | ||
20 | 21 | ||
21 | try: | 22 | try: |
22 | from urllib.parse import urlparse | 23 | from urllib.parse import urlparse |
@@ -1083,17 +1084,13 @@ class Mastodon: | |||
1083 | """ | 1084 | """ |
1084 | Converts json string IDs to native python bignums. | 1085 | Converts json string IDs to native python bignums. |
1085 | """ | 1086 | """ |
1086 | if sys.version_info.major >= 3: | 1087 | for key in ('id', 'in_reply_to_id', 'in_reply_to_account_id'): |
1087 | str_type = str | 1088 | if (key in json_object and |
1088 | else: | 1089 | isinstance(json_object[key], six.text_type)): |
1089 | str_type = unicode | 1090 | try: |
1090 | 1091 | json_object[key] = int(json_object[key]) | |
1091 | if ('id' in json_object and | 1092 | except ValueError: |
1092 | isinstance(json_object['id'], str_type)): | 1093 | pass |
1093 | try: | ||
1094 | json_object['id'] = int(json_object['id']) | ||
1095 | except ValueError: | ||
1096 | pass | ||
1097 | 1094 | ||
1098 | return json_object | 1095 | return json_object |
1099 | 1096 | ||