use six instead of relying on python version

This commit is contained in:
codl 2017-11-26 22:33:08 +01:00
pare da438529e0
commit ca11ef77ac
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 6CD7C8891ED1233A

Veure arxiu

@ -17,6 +17,7 @@ import re
import copy import copy
import threading import threading
import sys import sys
import six
try: try:
from urllib.parse import urlparse from urllib.parse import urlparse
@ -1083,13 +1084,8 @@ class Mastodon:
""" """
Converts json string IDs to native python bignums. 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 if ('id' in json_object and
isinstance(json_object['id'], str_type)): isinstance(json_object['id'], six.text_type)):
try: try:
json_object['id'] = int(json_object['id']) json_object['id'] = int(json_object['id'])
except ValueError: except ValueError: