[mod_python] Decoding POST requests

Graham Dumpleton grahamd at dscpl.com.au
Mon Jan 15 19:54:43 EST 2007


Bob Gailer wrote ..
> I'm getting POST request data from a form using request.read(). I note
> that blanks have been coded as +, + as %2B, etc. etc. How do I decode 
> this? My goal is to use HTTPRequest to send POST data. How do I specify
> the coding? What alternatives are there?  Is there any reference to all
> of this?

What sort of POST request data is it? If it is either of the standard forms:

  application/x-www-form-urlencoded
  multipart/* (eg. multipart/mixed)

you can use the FieldStorage class included with mod_python. See the
documentation for details.

Also look at the parse_qs() functions in documentation as well.

Documentation at:

  http://www.modpython.org/live/current/doc-html/pyapi-util.html

Graham



More information about the Mod_python mailing list