BaseHTTPServer module

Tim Roberts timr at probo.com
Mon Nov 21 02:28:23 EST 2005


"amfr" <amfr.org at gmail.com> wrote:
>
>>From the BaseHTTPServer module, how do i gget the POST or GET data sent
>by the client?  Is it stired the the file they requested? e.g.
>objectname.path

Did you check the documentation in the module?  You need to derive your own
class from BaseHTTPServer.  In that module, you need to add functions
called do_GET and do_POST.

In a GET request, the data is all encoded in the URL.  You'll find that in
self.path.

In a POST request, the data is all encoded in the body of the request.
You'll find that in self.rfile.  You'll have to parse and decode it
yourself.

However, as the module documentation also tells you, that has already been
done for you in SimpleHTTPServer.py.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list