Shwetha K
Shwetha K

Reputation: 37

xml parse response from API xml request

I'm trying to parse the xml api response to xml parse. This is the code

from xml.dom import minidom 
response = requests.post(url, data=request_xml.encode('utf8'), headers=headers)
xmldoc = minidom.parse(response.content)

But I'm not able to pass the response object. instead of response object if i pass xml file it works correctly. xmldoc = minidom.parse('exmple.xml') I want to parse the response object.

Can anyone please help me with this. I'm very greatful. thank you soo much in advance

Upvotes: 0

Views: 673

Answers (1)

user5386938
user5386938

Reputation:

Try, minidom.parseString

xmldoc = minidom.parseString(response.content)

Upvotes: 1

Related Questions