python 2.7 - How do I get urlparse.parse_qs to parse a url-encoded list -
i'm using parse_qs turn query params of url dictionary. when query param list, instead of getting list list embedded in string.
>>> urlparse.parse_qs('products=%5b%22ef184%22%2c%22dvf80%22%5d') {'products': ['["ef184","dvf80"]']} i'm trying {'products': [["ef184","dvf80"]]}.
decoding first urllib.unqote not either
>>> decoded = urllib.unquote('products=%5b%22ef184%22%2c%22dvf80%22%5d') >>> urlparse.parse_qs(decoded) {'products': ['["ef184","dvf80"]']} or
>>> urlparse.parse_qs('products=["ef184","dvf80"]') {'products': ['["ef184","dvf80"]']} i second pass , attempt parse keys json, seems hack. docs urlparse don't mention lists. there better way this?
Comments
Post a Comment