473,466 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

post xml payload with urllib

Has anyone sent an xml payload via post using urllib? I'd like to do
something like this:

logon_request = """<LoginRequest>
<password>"the_password"</password>
<user>"the_user"</user>
</LoginRequest>"""

logon = urllib.urlopen("https://127.0.0.1/api/version/xml", logon_request)
print logon.read()
logon.close()

127.0.0.1 expects xml via a https connection post.
Aug 14 '07 #1
1 6495
On Aug 14, 11:57 am, brad <byte8b...@gmail.comwrote:
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()


Aug 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: franck | last post by:
HI, this is my code params = {} params = '*****'; params = '***'; params = '**********'; params = '******'; params = '****';
0
by: Pieter Edelman | last post by:
Hi all, I'm trying to submit some data using a POST request to a HTTP server with BASIC authentication with python, but I can't get it to work. Since it's driving me completely nuts, so here's...
0
by: Neal | last post by:
Hi All When using a webrequest Post or Get , I keep getting an empty response stream (it is supposed to be an XML file returned via a call to some Systems GetXMLFileAPI) If i paste the URL...
0
by: Mallya | last post by:
All, I am trying to post XML data to https site and try to get repsonce in XML - I think i am wrting XMl to the site properly. - But the at server side - the message format is wrong (thats what...
1
by: Wobbly Bob | last post by:
Hi, I'm trying to write a program to test an asp based web site. I need to mimic form data being posted to a page and have tried the following code, based on the documentation. I get this error: ...
4
by: James Johnson | last post by:
Dear C#Dex, I am trying to automate a POST to a web page that clicks a button. I have been able to hit a target web page and run the web page. However, the button on the page does not click. ...
1
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the html for the logon user's default page. We've...
0
by: Owen | last post by:
Hello everyone, I am using VS.NET 2003(Trandition Chinese) Edition, and httpLook software for checking http requests. I found a problem that the following programs don't really "POST". These...
2
by: andy | last post by:
I have a routine I call to post XML from vb.net to a url over http It can be the XML file can be quite a size sometime I expect it to exceed 10mb. I started using a routine to post the file to a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.