@@ -64,6 +64,7 @@ def __init__(
6464 token : str | None = None ,
6565 * ,
6666 api_url : str | None = None ,
67+ api_public_url : str | None = None ,
6768 max_retries : int | None = 8 ,
6869 min_delay_between_retries_millis : int | None = 500 ,
6970 timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -72,7 +73,10 @@ def __init__(
7273
7374 Args:
7475 token: The Apify API token.
75- api_url: The URL of the Apify API server to which to connect to. Defaults to https://api.apify.com.
76+ api_url: The URL of the Apify API server to which to connect. Defaults to https://api.apify.com. It can
77+ be an internal URL that is not globally accessible, in such case `api_public_url` should be set as well.
78+ api_public_url: The globally accessible URL of the Apify API server. It should be set only if the `api_url`
79+ is an internal URL that is not globally accessible.
7680 max_retries: How many times to retry a failed request at most.
7781 min_delay_between_retries_millis: How long will the client wait between retrying requests
7882 (increases exponentially from this value).
@@ -81,6 +85,8 @@ def __init__(
8185 self .token = token
8286 api_url = (api_url or DEFAULT_API_URL ).rstrip ('/' )
8387 self .base_url = f'{ api_url } /{ API_VERSION } '
88+ api_public_url = (api_public_url or DEFAULT_API_URL ).rstrip ('/' )
89+ self .public_base_url = f'{ api_public_url } /{ API_VERSION } '
8490 self .max_retries = max_retries or 8
8591 self .min_delay_between_retries_millis = min_delay_between_retries_millis or 500
8692 self .timeout_secs = timeout_secs or DEFAULT_TIMEOUT
@@ -103,6 +109,7 @@ def __init__(
103109 token : str | None = None ,
104110 * ,
105111 api_url : str | None = None ,
112+ api_public_url : str | None = None ,
106113 max_retries : int | None = 8 ,
107114 min_delay_between_retries_millis : int | None = 500 ,
108115 timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -111,7 +118,10 @@ def __init__(
111118
112119 Args:
113120 token: The Apify API token.
114- api_url: The URL of the Apify API server to which to connect to. Defaults to https://api.apify.com.
121+ api_url: The URL of the Apify API server to which to connect. Defaults to https://api.apify.com. It can
122+ be an internal URL that is not globally accessible, in such case `api_public_url` should be set as well.
123+ api_public_url: The globally accessible URL of the Apify API server. It should be set only if the `api_url`
124+ is an internal URL that is not globally accessible.
115125 max_retries: How many times to retry a failed request at most.
116126 min_delay_between_retries_millis: How long will the client wait between retrying requests
117127 (increases exponentially from this value).
@@ -120,6 +130,7 @@ def __init__(
120130 super ().__init__ (
121131 token ,
122132 api_url = api_url ,
133+ api_public_url = api_public_url ,
123134 max_retries = max_retries ,
124135 min_delay_between_retries_millis = min_delay_between_retries_millis ,
125136 timeout_secs = timeout_secs ,
@@ -286,6 +297,7 @@ def __init__(
286297 token : str | None = None ,
287298 * ,
288299 api_url : str | None = None ,
300+ api_public_url : str | None = None ,
289301 max_retries : int | None = 8 ,
290302 min_delay_between_retries_millis : int | None = 500 ,
291303 timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -294,7 +306,10 @@ def __init__(
294306
295307 Args:
296308 token: The Apify API token.
297- api_url: The URL of the Apify API server to which to connect to. Defaults to https://api.apify.com.
309+ api_url: The URL of the Apify API server to which to connect. Defaults to https://api.apify.com. It can
310+ be an internal URL that is not globally accessible, in such case `api_public_url` should be set as well.
311+ api_public_url: The globally accessible URL of the Apify API server. It should be set only if the `api_url`
312+ is an internal URL that is not globally accessible.
298313 max_retries: How many times to retry a failed request at most.
299314 min_delay_between_retries_millis: How long will the client wait between retrying requests
300315 (increases exponentially from this value).
@@ -303,6 +318,7 @@ def __init__(
303318 super ().__init__ (
304319 token ,
305320 api_url = api_url ,
321+ api_public_url = api_public_url ,
306322 max_retries = max_retries ,
307323 min_delay_between_retries_millis = min_delay_between_retries_millis ,
308324 timeout_secs = timeout_secs ,
0 commit comments