docstring/util/url

This commit is contained in:
Marc Beninca 2024-08-19 17:18:41 +02:00
parent 42166a2c4e
commit 29c701b3d5
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -8,6 +8,7 @@ from rwx.log import stream as log
def add_url_path(url: str, extra_path: str) -> str: def add_url_path(url: str, extra_path: str) -> str:
"""Append an extra segment to an existing URL."""
parts = urlparse(url) parts = urlparse(url)
parts = parts._replace(path=str(Path(parts.path) / extra_path)) parts = parts._replace(path=str(Path(parts.path) / extra_path))
return urlunparse(parts) return urlunparse(parts)