use six instead of relying on python version
This commit is contained in:
pare
da438529e0
commit
ca11ef77ac
S'han modificat 1 arxius amb 2 adicions i 6 eliminacions
|
@ -17,6 +17,7 @@ import re
|
|||
import copy
|
||||
import threading
|
||||
import sys
|
||||
import six
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
|
@ -1083,13 +1084,8 @@ class Mastodon:
|
|||
"""
|
||||
Converts json string IDs to native python bignums.
|
||||
"""
|
||||
if sys.version_info.major >= 3:
|
||||
str_type = str
|
||||
else:
|
||||
str_type = unicode
|
||||
|
||||
if ('id' in json_object and
|
||||
isinstance(json_object['id'], str_type)):
|
||||
isinstance(json_object['id'], six.text_type)):
|
||||
try:
|
||||
json_object['id'] = int(json_object['id'])
|
||||
except ValueError:
|
||||
|
|
Loading…
Referencia en una nova incidència