Parsing the content of a 'Requests' call only shows some json data
To start here is some code:
import requests
import json
url = r'http:\\some.url'
p = requests.post(url)
print p.status_code
data = json.load(p)
for entry in data:
print entry
print data
The output of this program is as follows (note values are sanitized):
200
a
{"a":"b"}
Is there a way to get value "b" applied to a variable? Since the post will always return {"a"开发者_Go百科:"b"}, I don't really care what "a" is, since it is basically a constant.
Assuming Python 2.x:
>>> x = {"a":"b"}
>>> x.values()
['b']
>>> x.values()[0]
'b'
精彩评论