469,599 Members | 2,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

BaseHTTPServer - getting POST parameters

Hello,

After experimenting for a while, I am still not able to find where the
POST data is in the BaseHTTPRequestHandler class. I am trying to write
a very simple HTTP server for a project of mine and I need to get the
POST data. Certainly I am missing something, as it is a comon task.

Thanks in advance,
Vlad

Nov 14 '06 #1
2 3491
Vlad Dogaru wrote:
>
After experimenting for a while, I am still not able to find where the
POST data is in the BaseHTTPRequestHandler class. I am trying to write
a very simple HTTP server for a project of mine and I need to get the
POST data. Certainly I am missing something, as it is a comon task.
The way I've done this previously is to access the rfile attribute on
instances of the BaseHTTPRequestHandler class, since this provides the
body of each request (where POST data comes from) as a stream. Data
read from the stream can be processed by things like cgi.parse or
cgi.FieldStorage, although you may need to provide other data to those
things in order to simulate the CGI environment properly.

An alternative is to use WebStack's BaseHTTPRequestHandler support:

http://www.python.org/pypi/WebStack

Paul

Nov 14 '06 #2
Vlad Dogaru wrote:
After experimenting for a while, I am still not able to find where the
POST data is in the BaseHTTPRequestHandler class. I am trying to write
a very simple HTTP server for a project of mine and I need to get the
POST data. Certainly I am missing something, as it is a comon task.
it's nowhere: you're supposed to read it from the socket via the "rfile"
attribute.

</F>

Nov 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Joshua W. Biagio | last post: by
1 post views Thread by Yin | last post: by
2 posts views Thread by Simon Wittber | last post: by
4 posts views Thread by amfr | last post: by
13 posts views Thread by Ron Garret | last post: by
3 posts views Thread by Ron Garret | last post: by
1 post views Thread by James | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.