googlebooks icon indicating copy to clipboard operation
googlebooks copied to clipboard

feed decoded content to json.loads to avoid error

Open meokey opened this issue 7 years ago • 0 comments

there is an error occurs.

api._get('/volumes',params) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/site-packages/googlebooks.py", line 18, in _get return json.loads(resp.content) File "/usr/local/lib/python3.5/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

solution: use the below instead json.loads(resp.content.decode('utf-8'))

meokey avatar Aug 01 '18 18:08 meokey