@@ -64,6 +64,7 @@ def __init__(
64
64
token : str | None = None ,
65
65
* ,
66
66
api_url : str | None = None ,
67
+ api_public_url : str | None = None ,
67
68
max_retries : int | None = 8 ,
68
69
min_delay_between_retries_millis : int | None = 500 ,
69
70
timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -72,7 +73,10 @@ def __init__(
72
73
73
74
Args:
74
75
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.
76
80
max_retries: How many times to retry a failed request at most.
77
81
min_delay_between_retries_millis: How long will the client wait between retrying requests
78
82
(increases exponentially from this value).
@@ -81,6 +85,8 @@ def __init__(
81
85
self .token = token
82
86
api_url = (api_url or DEFAULT_API_URL ).rstrip ('/' )
83
87
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 } '
84
90
self .max_retries = max_retries or 8
85
91
self .min_delay_between_retries_millis = min_delay_between_retries_millis or 500
86
92
self .timeout_secs = timeout_secs or DEFAULT_TIMEOUT
@@ -103,6 +109,7 @@ def __init__(
103
109
token : str | None = None ,
104
110
* ,
105
111
api_url : str | None = None ,
112
+ api_public_url : str | None = None ,
106
113
max_retries : int | None = 8 ,
107
114
min_delay_between_retries_millis : int | None = 500 ,
108
115
timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -111,7 +118,10 @@ def __init__(
111
118
112
119
Args:
113
120
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.
115
125
max_retries: How many times to retry a failed request at most.
116
126
min_delay_between_retries_millis: How long will the client wait between retrying requests
117
127
(increases exponentially from this value).
@@ -120,6 +130,7 @@ def __init__(
120
130
super ().__init__ (
121
131
token ,
122
132
api_url = api_url ,
133
+ api_public_url = api_public_url ,
123
134
max_retries = max_retries ,
124
135
min_delay_between_retries_millis = min_delay_between_retries_millis ,
125
136
timeout_secs = timeout_secs ,
@@ -286,6 +297,7 @@ def __init__(
286
297
token : str | None = None ,
287
298
* ,
288
299
api_url : str | None = None ,
300
+ api_public_url : str | None = None ,
289
301
max_retries : int | None = 8 ,
290
302
min_delay_between_retries_millis : int | None = 500 ,
291
303
timeout_secs : int | None = DEFAULT_TIMEOUT ,
@@ -294,7 +306,10 @@ def __init__(
294
306
295
307
Args:
296
308
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.
298
313
max_retries: How many times to retry a failed request at most.
299
314
min_delay_between_retries_millis: How long will the client wait between retrying requests
300
315
(increases exponentially from this value).
@@ -303,6 +318,7 @@ def __init__(
303
318
super ().__init__ (
304
319
token ,
305
320
api_url = api_url ,
321
+ api_public_url = api_public_url ,
306
322
max_retries = max_retries ,
307
323
min_delay_between_retries_millis = min_delay_between_retries_millis ,
308
324
timeout_secs = timeout_secs ,
0 commit comments