in app/endpoints/oauth.py [0:0]
def make_redirect_url(url, **kwargs):
"""Appends any number of query string args to an existing URL"""
# Parse original URL, so we can munge it with our token
origin_url = urllib.parse.unquote(url)
url_parsed = urllib.parse.urlparse(origin_url)
args = dict(urllib.parse.parse_qsl(url_parsed.query))
# Add the token
args.update(**kwargs)
# Encode args and reconstruct URL
args_encoded = urllib.parse.urlencode(args, doseq=True)
new_url = urllib.parse.ParseResult(
url_parsed.scheme, url_parsed.netloc, url_parsed.path, url_parsed.params, args_encoded, url_parsed.fragment
).geturl()
return new_url