Web development with Python 3.1
Mikhail M.Smagin
mms at x3.dp.ua
Wed Oct 28 06:09:05 EDT 2009
Hello, Dotan
On Wed, 28 Oct 2009 10:26:22 +0200
Dotan Cohen <dotancohen at gmail.com> wrote:
> I should probably expand on this:
>
> How can I get an array with all the GET variables in Python?
> How can I get an array with all the POST variables in Python?
> How can I get an array with all the COOKIE variables in Python?
> How can I get the request URI path (everything after
> http://[www.?]example.com/)?
>
> That's all I want: no templates and nothing between me and the HTML.
> The HTTP headers I can output to stdout myself as well.
$python
>>help(cgi)
>>help(cgitb)
>>help(Cookie)
>>help(urlparse)
>>help(os.environ)
GET variables:
-------------------------------------------------------------------------
import os,cgi
if os.environ.has_key('QUERY_STRING'):
getv = cgi.parse_qs(os.environ['QUERY_STRING'])
print getv.keys()
Other examples is very simple too...
--
Mikhail M.Smagin <mms at x3.dp.ua>
More information about the Python-list
mailing list