Skip to content

Commit

Permalink
python 3 needs an explicit decode for the result
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Nov 6, 2014
1 parent d1da754 commit 21e0a5e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions duedil/v3pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,9 @@ def get(self):
get results from duedil
"""
data = {'api_key': self.api_key, 'nullValue':None}
result = json.load(urlopen('%s?%s'
%(self.url, urlencode(data))))
req = urlopen('%s?%s'
%(self.url, urlencode(data)))
result = json.loads(req.read().decode('utf-8'))
assert(result['response'].pop('id') == self.id)
self._set_attributes(missing=True, **result['response'])
return result
Expand Down Expand Up @@ -732,8 +733,9 @@ def search_company(self, order_by=None, limit=None, offset=None, **kwargs):
if offset:
assert(isinstance(offset, int))
data['offset'] = offset
results = json.load(urlopen('%s/companies?%s'
%(self.url, urlencode(data))))
req = urlopen('%s/companies?%s'
%(self.url, urlencode(data)))
results = json.loads(req.read().decode('utf-8'))
self.last_company_response = results
companies = []
for r in results['response']['data']:
Expand Down

0 comments on commit 21e0a5e

Please sign in to comment.