I've recently starting using the requests library (which is excellent). However when I get a request response via a post method it seems to return a String(unicode) , when I check the type, even though it looks like a dictionary - which makes it more difficult to pull data from it.
Is there a way to have the json data returned in dictionary format, so I can easily extract a couple of fields?
specifically a request like:
>>> payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.post("http://httpbin.org/post", data=payload)
>>> print(r.text)
{
...
"form": {
"key2": "value2",
"key1": "value1"
},
...
}
r.text is a unicode string not a dictionary (even though it looks like one above)?