diff options
author | codl <[email protected]> | 2017-11-26 22:33:08 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-26 22:33:08 +0100 |
commit | ca11ef77acf60fdee5f20fbdb4c3e6ce5f2cbacc (patch) | |
tree | 3a28cc110ad5fa771d90032a1f52de6573647a2b /mastodon | |
parent | da438529e082c85307659b765681abe9eb214ff5 (diff) | |
download | mastodon.py-ca11ef77acf60fdee5f20fbdb4c3e6ce5f2cbacc.tar.gz |
use six instead of relying on python version
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 8 |
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 | |||
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,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: |