开发者

What is the use of FieldStorage in Python

I want to know whats the difference between FieldSt开发者_Python百科orage in Python and wsgi_input?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜