aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-26 22:33:08 +0100
committercodl <[email protected]>2017-11-26 22:33:08 +0100
commitca11ef77acf60fdee5f20fbdb4c3e6ce5f2cbacc (patch)
tree3a28cc110ad5fa771d90032a1f52de6573647a2b
parentda438529e082c85307659b765681abe9eb214ff5 (diff)
downloadmastodon.py-ca11ef77acf60fdee5f20fbdb4c3e6ce5f2cbacc.tar.gz
use six instead of relying on python version
-rw-r--r--mastodon/Mastodon.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 88f4906..9e6d3ce 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,13 +1084,8 @@ 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 str_type = str
1088 else:
1089 str_type = unicode
1090
1091 if ('id' in json_object and 1087 if ('id' in json_object and
1092 isinstance(json_object['id'], str_type)): 1088 isinstance(json_object['id'], six.text_type)):
1093 try: 1089 try:
1094 json_object['id'] = int(json_object['id']) 1090 json_object['id'] = int(json_object['id'])
1095 except ValueError: 1091 except ValueError:
Powered by cgit v1.2.3 (git 2.41.0)