Reputation: 838
I'm trying to get a parameter from a JSON string loaded with requests.
I think I tried any combination I can think of.
Any hints are very appreciated.
My code is this:
r = requests.get(url, headers=headers)
json_string = r.json
status = json.dumps(json_string['httpStatusCode'])
and I'm getting
'method' object is not subscriptable
Upvotes: 4
Views: 5625
Reputation: 181
The error you are getting because you are assigning a "method" object to json_string.
Since in python "method" objects are not subscriptable.
To get JSON response you have to do this
json_string = r.json()
Upvotes: 5