How would you suggest I post xml data to a url in django.
For example, in my views.py when the view is called, I am trying to do a post to a url and then return the xml response content.
What I have so far:
import xml
URL ="http://something.com"
def process(request):
response = None
if request.method=="POST":
xml_data = """
<?xml version='1.0' encoding='UTF-8'?>
<something><retrieve_user>Tammy</retrieve_user></something>
"""
headers = {
"Host": "myhost",
"Content-Type": "text/xml; charset=UTF-8",
"Content-Length": len(xml_data)
}
#make response variable equal to process to post xml_data and headers to URL
response = ??
return response
After this, how can I get the value of the response content. For example if the response content returned this:
<response_begin>
<array>
<info>
<name>Name Something</name>
<email>Email Something</email>
</info>
<info>...</info>
</array>
</response_begin>
How can I retrieve the values "Name Something" and "Email Something"? Thanks in advance.