def query(match, value): if not value: return try: parameters = urlparse.parse_qsl(value, strict_parsing=True) except ValueError: return for key, value in parameters: match.setdefault(key, value)
def fill_query(guid, query): # Parse query parameters parameters = dict(urlparse.parse_qsl(query)) # Update `guid` with parameters guid.language = parameters.get('lang')