Re: BaseHTTPServer - getting POST parameters



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

.



Relevant Pages

  • BaseHTTPServer - getting POST parameters
    ... After experimenting for a while, I am still not able to find where the ... POST data is in the BaseHTTPRequestHandler class. ... as it is a comon task. ...
    (comp.lang.python)
  • Re: BaseHTTPServer - getting POST parameters
    ... Vlad Dogaru wrote: ... POST data is in the BaseHTTPRequestHandler class. ... a very simple HTTP server for a project of mine and I need to get the ...
    (comp.lang.python)
  • Re: Using Webdav for attachments in 2007
    ... CookieJar = New CookieContainer ... ' Create our post data string that is required by OWA ... Dim tmpStream As Stream ... ' Create a request stream. ...
    (microsoft.public.exchange.development)
  • Re: Using Webdav for attachments in 2007
    ... CookieJar = New CookieContainer ... ' Create our post data string that is required by OWA ... Dim tmpStream As Stream ... ' Create a request stream. ...
    (microsoft.public.exchange.development)
  • Re: How to retrieve raw HTTP Post Data
    ... Turned out there was an extra byte in their stream breaking ... I've found is centered around retrieving POST data as name/value pairs ... What I need to do is retrieve the raw POST data and save it as a ...
    (microsoft.public.dotnet.framework.aspnet)