I’m using Python’s BaseHTTPRequestHandler. When I implement the do_GET method I find myself parsing by hand self.path
self.path looks something like:
/?parameter=value&other=some
How should I parse it in order to get a dict like
{'parameter': 'value', 'other':'some'}
Thanks,
Use
parse_qsfrom theurlparsemodule, but make sure you remove the “/?”:Note that each parameter can have multiple values, so the returned dict maps each parameter name to a list of values.