requests does not parse XML responses, no. XML responses are much more complex in nature than JSON responses, as you serialized XML data in Python structures is not so simple.
Python comes with built-in XML parsers. I recommend using the ElementTree API :
import requests from xml.etree import ElementTree response = requests.get(url) tree = ElementTree.fromstring(response.content)
or, if the answer is especially large, use the incremental approach:
response = requests.get(url, stream=True)
The external lxml project is based on the same API, which gives you more options and power.
Martijn Pieters Aug 19 '13 at 7:33 2013-08-19 07:33
source share