python - Calling cgi.FieldStorage for an arbitrary url -
I want to get the field value for an arbitrary URL. To wit. Given "" I need a dictionary {'q': 1, 'b': 1}. How can I use cgi.FieldStorage?
Thank you!
You can use Urlparse that
urlparse import From urlparse, parse_qs qs = urlparse ("http://example.com/hello?q=1&b=1"). Some parse_qs (qs)
If you have FieldStorage < / Code>
cgi.FieldStorage (environment = {'REQUEST_METHOD': 'GET', 'QUERY_STRING': qs})
Comments
Post a Comment