doc/add_url_path
This commit is contained in:
parent
7251ca35fa
commit
ac72fb1331
1 changed files with 9 additions and 1 deletions
10
spcd/util.py
10
spcd/util.py
|
@ -12,7 +12,15 @@ from spcd.shell import env
|
|||
|
||||
|
||||
def add_url_path(url: str, extra_path: str) -> str:
|
||||
"""Append an extra segment to an existing URL."""
|
||||
"""Append an extra segment to an existing URL.
|
||||
|
||||
:param url: base URL
|
||||
:type url: str
|
||||
:param extra_path: path to append
|
||||
:type extra_path: str
|
||||
:return: new URL
|
||||
:rtype: str
|
||||
"""
|
||||
parts = urlparse(url)
|
||||
parts = parts._replace(path=str(Path(parts.path) / extra_path))
|
||||
return urlunparse(parts)
|
||||
|
|
Loading…
Reference in a new issue