I have got a use case to hit a RESTful API which returns response in XML format. I need to access that response, access the data in it and store that data into a CSV file. All of above needs to be done using Python. I am a noob in Python, but after some googling I got to know that 'requests', 'xml.etree' etc are the packages which are useful in it but I am getting confused between all of them.
The problem is that XML response is very large, and when you hit the API from browser, it shows only first 10 records out of thousands. So I don't know how to get the full response in one go OR in increment fashion.
Below is the code which hits the API and prints the response.
import requests
from xml.etree import ElementTree
response2 = requests.get("http://www.myapi.com/api/v2_2/eventEditions/1234/participants/companies", auth=('username', 'password'))
print response2
tree = ElementTree.fromstring(response2.content)
print tree
print response2.content
Can someone suggest what should be my approach in this and the packages, methods to achieve it?