Doing POST opperations from Python
Oleg Broytmann
phd at emerald.netskate.ru
Wed Sep 1 05:02:25 EDT 1999
On Tue, 31 Aug 1999, Phil Wise wrote:
> I am trying to produce POST requests within python
> (to drive a web based email client). I can do GET requests,
> but can understand how to do post. I have read RFC1945
> (Informational), but I can find the info there either.
> I understand that the data is sent as part of the headers,
> but how?
In POST, data goes after header - in the body of request. Here is how it
looks for browser to send a request:
(--connect to the server--)
POST /cgi-bin/test.cgi HTTP/1.0
Host: virtual.host.domain
Content-Length: 21
nowtest=yes&verbose=1
(--here the server stops reading, processes the request and replies--)
Please note: Content-Length header MUST present as it show how much data
server have to read. After header there is one empty line (as required by
HTTP protocol) and url-encoded data.
Oleg.
----
Oleg Broytmann http://members.xoom.com/phd2/ phd2 at earthling.net
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list