I\'m trying to set up a HTTP server in a Python script. So far I got the server it self to work, with a code similar to the below, from here.
from BaseHTTPSe
Import urlparse
and do:
def do_GET(self):
qs = {}
path = self.path
if '?' in path:
path, tmp = path.split('?', 1)
qs = urlparse.parse_qs(tmp)
print path, qs
urlparse.parse_qs()
print urlparse.parse_qs(os.environ['QUERY_STRING'])
Or if you care about order or duplicates, urlparse.parse_qsl().
Import in Python 3: from urllib.parse import urlparse