If you happen to get an error that says “JSON must be str not bytes” when you process your API query results, try calling .decode('utf-8') on the content you get back. (So, if resp is the name of the variable you stored the result of requests.get() in, do json.loads(resp.content.decode('utf-8')) instead of just json.loads(resp.content).)

Leave a Reply

Your email address will not be published. Required fields are marked *