aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-11-27 11:59:27 +0100
committerGitHub <[email protected]>2017-11-27 11:59:27 +0100
commit52d57d9d435ad0032648835150aacda7fbc1f91c (patch)
tree3d97d9b20af26e19f2de82d0aa2105dddc7c240a /mastodon
parentda438529e082c85307659b765681abe9eb214ff5 (diff)
parentb9e6a1e9baf9ec5238dcc3b4344b2a0ae07411ac (diff)
downloadmastodon.py-52d57d9d435ad0032648835150aacda7fbc1f91c.tar.gz
Merge pull request #104 from codl/fix-string-ids
fix string id support to also include in_reply_to_... fields
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py19
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
17import copy 17import copy
18import threading 18import threading
19import sys 19import sys
20import six
20 21
21try: 22try:
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
Powered by cgit v1.2.3 (git 2.41.0)