join_url
Construct a full URL by combining a base URL with other URLs.
It is essentially a wrapper of
urllib.parse.urljoin()
. Whileurllib.parse.urljoin()
accepts only two arguments, this wrapperfunction accepts multiple arguments to sequentially join the given items.Examples
>>> join_url('https://www.example.com/', 'dir/', 'subdir/', 'filename.txt') 'https://www.example.com/dir/subdir/filename.txt'
>>> join_url('https://www.example.com/', 'dir/', 'subdir/', '/another_dir/' 'filename.bin') 'https://www.example.com/another_dir/filename.bin'