views:

28

answers:

1

I want to know whats the difference between FieldStorage in Python and wsgi_input?

A: 

FieldStorage is useful in CGI contexts and can help in some other cases in which you want to do your own parsing and handling of (e.g.) a form posted (or also sent by a GET;-) to your server, without necessarily involving WSGI in any way. It provided a nicely accessible, somewhat dict-like object for accessing the form data (whether in a POST or GET context).

I'm not sure what wsgi_input (with an underscore) is; if you mean wsgi.input (with a dot, and, normally, quotes around it;-), it's a key in a WSGI environment whose value must be, quoting from PEP 333:

An input stream (file-like object) from which the HTTP request body can be read.

So it only exists in a WSGI context and does not imply that any parsing of that request body has been done -- parsing of the request body (to receive POSTs, specifically), if any, must happen "using" that stream.

Alex Martelli
It's with dot, my mistake.
hidura
Thanks for the answer.
hidura
@hidura, you're welcome!
Alex Martelli