473,289 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

How to send a POST request?

kj

Hi. Sorry for this very clueless question, but how does one write
in Python an HTTP client that can send a POST request? The modules
I've found (e.g. urllib, urllib2), as far as I can tell, seem to
be limited to GET requests. (I could be wrong though; please
correct me if this is so.)

TIA!

kynn

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Jun 27 '08 #1
4 4618
kj
In <g2**********@reader2.panix.comkj <so***@987jk.com.invalidwrites:
>Hi. Sorry for this very clueless question, but how does one write
in Python an HTTP client that can send a POST request? The modules
I've found (e.g. urllib, urllib2), as far as I can tell, seem to
be limited to GET requests. (I could be wrong though; please
correct me if this is so.)
Sorry, my mistake. I now see that urllib2 handles POSTs too.

kynn

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Jun 27 '08 #2
The original urllib module will do it too, if you pass a data keyword
argument to urllib.urlopen:

u = urllib.urlopen('http://www.domain.com/cgi-bin/cgi.py',
data=urllib.urlencode({'name': 'pythonguy'}))
On Fri, Jun 6, 2008 at 6:04 PM, kj <so***@987jk.com.invalidwrote:
In <g2**********@reader2.panix.comkj <so***@987jk.com.invalidwrites:
>>Hi. Sorry for this very clueless question, but how does one write
in Python an HTTP client that can send a POST request? The modules
I've found (e.g. urllib, urllib2), as far as I can tell, seem to
be limited to GET requests. (I could be wrong though; please
correct me if this is so.)

Sorry, my mistake. I now see that urllib2 handles POSTs too.

kynn

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #3
On Jun 7, 6:17 am, "Jeff McNeil" <j...@jmcneil.netwrote:
The original urllib module will do it too, if you pass a data keyword
argument to urllib.urlopen:

u = urllib.urlopen('http://www.domain.com/cgi-bin/cgi.py',
data=urllib.urlencode({'name': 'pythonguy'}))

On Fri, Jun 6, 2008 at 6:04 PM, kj <so...@987jk.com.invalidwrote:
In <g2cc24$63...@reader2.panix.comkj <so...@987jk.com.invalidwrites:
>Hi. Sorry for this very clueless question, but how does one write
in Python an HTTP client that can send a POST request? The modules
I've found (e.g. urllib, urllib2), as far as I can tell, seem to
be limited to GET requests. (I could be wrong though; please
correct me if this is so.)
Sorry, my mistake. I now see that urllib2 handles POSTs too.
kynn
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
--
http://mail.python.org/mailman/listinfo/python-list
check this link for http post:
http://love-python.blogspot.com/2008...l-by-http.html

regards,
Subeen
Jun 27 '08 #4
kj


Thanks to Jeff and subeen for the helpful comments and suggestions.

Kynn
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Jun 27 '08 #5

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

Similar topics

3
by: Erik T. Nomad | last post by:
I've created a link that will enable the reader of any page on my website to click it, enter an e-mail address, and have it arrive in that inbox with a hyperlink to the site. However, I'm...
1
by: malborg | last post by:
I have simple form in PHP with two input types as text to input login name and password.PS: They use POST method. (index.php) The other script(logowanie.php) checks if login and password is...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
5
by: mark kurten | last post by:
i have a requirement to send a soap message to a web service. i'm familiar with the soap toolkit using vb. i need to generate a xml document which i think i can do, but i don't know how to...
2
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none...
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
4
by: Zahid | last post by:
Hi, I have a number of structures that I want to send using UDP protocol. How do I convert the structure into bytes/array of bytes? Using UDP protocol is a MUST - a Client Requirement. Am I...
2
by: inferno2000 | last post by:
Let's say if I want to send a http "Post" request to a url, and check the http status code later. How should I write the code? I have found example to use WinHttp to send "Get" request and check...
3
by: keith.schincke | last post by:
I know I must be missing something basic. I am developing of Firefox 1.5 and am trying to to send a basic QUERY_STRING to a test CGI that will print the data back to the brower: I can print my...
2
by: ajaxcoder | last post by:
Hi In my project i had a login form and i am trying to send the username and password to the server for authentication using xmlHttpRequest. Hence i am using POST request but i am unable to send...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.