Skip to content

Commit 77c5f20

Browse files
committed
Treat url and public url the same way with respect to the v2 part of the path
1 parent d7163b8 commit 77c5f20

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/apify_client/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def __init__(
8585
self.token = token
8686
api_url = (api_url or DEFAULT_API_URL).rstrip('/')
8787
self.base_url = f'{api_url}/{API_VERSION}'
88-
self.public_base_url = (api_public_url or DEFAULT_API_URL).rstrip('/')
88+
api_public_url = (api_public_url or DEFAULT_API_URL).rstrip('/')
89+
self.public_base_url = f'{api_public_url}/{API_VERSION}'
8990
self.max_retries = max_retries or 8
9091
self.min_delay_between_retries_millis = min_delay_between_retries_millis or 500
9192
self.timeout_secs = timeout_secs or DEFAULT_TIMEOUT

src/apify_client/clients/base/base_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
from typing import TYPE_CHECKING, Any
4-
from urllib.parse import urljoin, urlparse
54

65
from apify_client._logging import WithLogDetailsClient
76
from apify_client._utils import to_safe_id
@@ -23,7 +22,7 @@ def _url(self, path: str | None = None, *, public: bool = False) -> str:
2322
url = f'{self.url}/{path}' if path is not None else self.url
2423

2524
if public:
26-
return urljoin(self.root_client.public_base_url + '/', urlparse(url).path.strip('/'))
25+
return url.replace(self.root_client.base_url, self.root_client.public_base_url)
2726
return url
2827

2928
def _params(self, **kwargs: Any) -> dict:

0 commit comments

Comments
 (0)