api results should be unicode
This commit is contained in:
parent
2c141fdbcf
commit
da22dc0bf1
1 changed files with 2 additions and 0 deletions
|
@ -61,6 +61,7 @@ class API(object):
|
||||||
request.add_header('Content-length', len(body))
|
request.add_header('Content-length', len(body))
|
||||||
request.add_data(body)
|
request.add_data(body)
|
||||||
result = self._opener.open(request).read().strip()
|
result = self._opener.open(request).read().strip()
|
||||||
|
result = result.decode('utf-8')
|
||||||
return json.loads(result)
|
return json.loads(result)
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
if self.DEBUG:
|
if self.DEBUG:
|
||||||
|
@ -72,6 +73,7 @@ class API(object):
|
||||||
|
|
||||||
result = e.read()
|
result = e.read()
|
||||||
try:
|
try:
|
||||||
|
result = result.decode('utf-8')
|
||||||
result = json.loads(result)
|
result = json.loads(result)
|
||||||
except:
|
except:
|
||||||
result = {'status':{}}
|
result = {'status':{}}
|
||||||
|
|
Loading…
Reference in a new issue