Accessing POST parameters from BaseHTTPServer

Steve Holden steve at holdenweb.com
Thu Nov 6 23:08:26 EST 2008


James wrote:
> Hi all,
> I'm writing a super simple little debugging HTTP server which simply
> returns the path and parameters it receives requests for.
> 
> E.g. requesting /meth?a=b returns something like:
> Command: GET
> Path: /meth
> Params: {'a': ['b']}
> 
> This is fine for GET, but I can't see how I access parameters passed
> by POST requests...
> 
> The particular client programme I'm testing will be passing stuff up
> as text/xml, if that's any help...
> 
You read the standard input and decode them according to the relevant
RFC. The source of the cgi module could be enlightening there. You might
even consider importing it and using it ...

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list