post xml payload with urllib
mirandacascade at yahoo.com
mirandacascade at yahoo.com
Tue Aug 14 15:24:11 EDT 2007
On Aug 14, 11:57 am, brad <byte8b... at gmail.com> wrote:
> Has anyone sent an xml payload via post using urllib?
Haven't used urllib, but have used urllib2 to do a POST.
Might something like this work...
import urllib2
logon_request = """<LoginRequest>
<password>"the_password"</password>
<user>"the_user"</user>
</LoginRequest>"""
req = urllib2.Request("https://127.0.0.1/api/version/xml",
data=logon_request)
openObj = urllib2.urlopen(req)
response = openObj.read()
More information about the Python-list
mailing list