Merge "Add python 3 support"
This commit is contained in:
commit
80f06b9b85
@ -33,6 +33,7 @@ from datetime import datetime
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
|
import six
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
import six.moves.builtins as __builtin__
|
import six.moves.builtins as __builtin__
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
@ -184,7 +185,7 @@ class ApiClient(object):
|
|||||||
"""
|
"""
|
||||||
if isinstance(obj, type(None)):
|
if isinstance(obj, type(None)):
|
||||||
return None
|
return None
|
||||||
elif isinstance(obj, (unicode, str, int, float, bool, tuple, file)):
|
elif isinstance(obj, (six.text_type, str, int, float, bool, tuple, file)):
|
||||||
return obj
|
return obj
|
||||||
elif isinstance(obj, list):
|
elif isinstance(obj, list):
|
||||||
return [self.sanitize_for_serialization(sub_obj)
|
return [self.sanitize_for_serialization(sub_obj)
|
||||||
@ -488,7 +489,7 @@ class ApiClient(object):
|
|||||||
try:
|
try:
|
||||||
value = klass(data)
|
value = klass(data)
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
value = unicode(data)
|
value = six.text_type(data)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
value = data
|
value = data
|
||||||
return value
|
return value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user