Web development with Python 3.1

Dotan Cohen dotancohen at gmail.com
Wed Oct 28 06:30:58 EDT 2009


>> 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...
>

Thanks,  Mikhail. I now have a bit to google on.


-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il



More information about the Python-list mailing list