Code: Alles auswählen
cgi.parse_qs("""GET /foobar?from=raseh&to=ah&subject=atdj&Frage=strdj HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://127.0.0.1/
""")
{'q': ['0.9,text/plain', '0.8,image/png,*/*', '0.5\nAccept-Language: de-de,de', '0.8,en-us', '0.5,en', '0.3\nAccept-Encoding: gzip,deflate\nAccept-Charset: ISO-8859-1,utf-8', '0.7,*', '0.7\nKeep-Alive: 300\nConnection: keep-alive\nReferer: http://127.0.0.1/\n\n'], 'to': ['ah'], 'GET /foobar?from': ['raseh'], 'Frage': ['strdj HTTP/1.1\nHost: 127.0.0.1\nUser-Agent: Mozilla/5.0 (Windows'], 'subject': ['atdj']}
>>> req = _
>>> req["Frage"]
['strdj HTTP/1.1\nHost: 127.0.0.1\nUser-Agent: Mozilla/5.0 (Windows']
>>> req["subject"]
['atdj']
danke