doc/add_url_path

This commit is contained in:
Marc Beninca 2024-09-16 01:14:52 +02:00
parent 7251ca35fa
commit ac72fb1331
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -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)