Get Specific Json Elements With Requests
I want to make a JSON request with the Python library requests where I only obtain certain JSON objects. I know that it is really easy to process the JSON object obtained to only f
Solution 1:
Short Answer
To answer your question no, you can't but to understand why you need to know what is happening behind the scenes.
Behind the scenes
When you make a request such as r = requests.get('www.foo.bar')
you are making a request to the server and you are viewing the result of that request when you do r.json()
. This means that you cannot just get r[3]['data']
as you are parsing what the server sends to you unless the server only sends r[3]['data']
. It may be possible to filter out everything else apart from that in the response processing but I am unaware of how to do it.
Post a Comment for "Get Specific Json Elements With Requests"