Skip to content

Instantly share code, notes, and snippets.

@justinfay
Created September 25, 2015 09:33
Show Gist options
  • Select an option

  • Save justinfay/d97069efda97e1d1720f to your computer and use it in GitHub Desktop.

Select an option

Save justinfay/d97069efda97e1d1720f to your computer and use it in GitHub Desktop.
def make_url(base, *fragments):
"""
>>> make_url('http://example.com', '1', '2', '3.html')
'http://example.com/1/2/3.html'
"""
path = str(pathlib.Path(*fragments))
return urllib.parse.urljoin(base, path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment