I got stuck not getting how to achieve it.
Need your suggestion on this how to implement in my code
My code :
import requests
url = '....' # not mentioning as its private
headers_details = {
'Host' : 'axb.vttp.com',
'Accept-Encoding' : 'gzip,deflate',
'Accept' : '*/*'
}
parameter = { 'id' : '4566' ,'key' :'tyuo' }
rq = requests.post( url,params=parameter, headers=headers_details)
with open('demo.xml','w') as wr:
wr.write(rq.content)
My data is written to my xml file. But its not in indent format the xml data.
How to achieve the xml data in file in proper indentation format
You've need to parse the xml, then serialise it with indentation.
With
lxml:See: