From be1eee8c9a6f24dd740ee3ce50a6370ccaf2359f Mon Sep 17 00:00:00 2001 From: Dylan Schultz <9121234+dylanschultzie@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:27:44 -0800 Subject: [PATCH] Add support for URLs with paths Signed-off-by: Dylan Schultz <9121234+dylanschultzie@users.noreply.github.com> --- cosmpy/aerial/urls.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cosmpy/aerial/urls.py b/cosmpy/aerial/urls.py index ee7c04e6..07ac6968 100644 --- a/cosmpy/aerial/urls.py +++ b/cosmpy/aerial/urls.py @@ -45,6 +45,7 @@ class ParsedUrl: secure: bool hostname: str port: int + path: str @property def host_and_port(self) -> str: @@ -71,6 +72,8 @@ def rest_url(self) -> str: url = f"{prefix}://{self.hostname}" if self.port != default_port: url += f":{self.port}" + if self.path: + url += self.path return url @@ -103,5 +106,6 @@ def parse_url(url: str) -> ParsedUrl: hostname = str(result.hostname) port = default_port if result.port is None else int(result.port) + path = result.path if result.path else "" - return ParsedUrl(protocol=protocol, secure=secure, hostname=hostname, port=port) + return ParsedUrl(protocol=protocol, secure=secure, hostname=hostname, port=port, path=path)