Python: Requests Module Response in JSON
Problem: I’m using the Requests Module for Python 3.5 to handle my HTTP get and post requests. I know I can get my response in JSON, but I’m having trouble accessing the keys on the response. When access a key that I know is in the response, it’s saying:
AttributeError: 'Response' object has no attribute 'keywords'
What am I doing wrong?
Solution: It looks like you’re trying to directly access the
Response object without first extracting the actual response JSON. The
Response object has several built-in functions and parameters that you can use (refer to the documentation linked above for more about that).
To get to the actual JSON response from your request, first extract the JSON object out into a new variable using the module’s
.json() method call then simply access that keyword within the created dictionary using
Here’s gist to get you started:[https://gist.github.com/SIRHAMY/20e6fc335191d0e45a7250786f3fe457]