add a simplified version of 'parse_qs'

This version only returns a dict of plain string to string key-value
pairs and ignores multiple values for the same query variable.
This commit is contained in:
Mike Fährmann
2017-08-24 20:55:58 +02:00
parent 3b21e0703c
commit f7cdfd4c25
4 changed files with 10 additions and 13 deletions

View File

@@ -130,6 +130,11 @@ def extract_iter(txt, begin, end, pos=0):
yield value
def parse_query(qs):
"""Parse a query string into key-value pairs"""
return {key: vlist[0] for key, vlist in urllib.parse.parse_qs(qs).items()}
if os.name == "nt":
clean_path = clean_path_windows
else: