66
77import httpx
88
9- from ..types import proxy_create_params
9+ from ..types import proxy_check_params , proxy_create_params
1010from .._types import Body , Omit , Query , Headers , NoneType , NotGiven , SequenceNotStr , omit , not_given
1111from .._utils import path_template , maybe_transform , async_maybe_transform
1212from .._compat import cached_property
@@ -195,17 +195,35 @@ def check(
195195 self ,
196196 id : str ,
197197 * ,
198+ url : str | Omit = omit ,
198199 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
199200 # The extra values given here take precedence over values defined on the client or passed to this method.
200201 extra_headers : Headers | None = None ,
201202 extra_query : Query | None = None ,
202203 extra_body : Body | None = None ,
203204 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
204205 ) -> ProxyCheckResponse :
205- """
206- Run a health check on the proxy to verify it's working.
206+ """Run a health check on the proxy to verify it's working.
207+
208+ Optionally specify a URL
209+ to test reachability against a specific target. For ISP and datacenter proxies,
210+ this reliably tests whether the target site is reachable from the proxy's stable
211+ exit IP. For residential and mobile proxies, the exit node varies between
212+ requests, so this validates proxy configuration and connectivity rather than
213+ guaranteeing site-specific reachability.
207214
208215 Args:
216+ url: An optional URL to test reachability against. If provided, the proxy check will
217+ test connectivity to this URL instead of the default test URLs. Only HTTP and
218+ HTTPS schemes are allowed, and the URL must resolve to a public IP address. For
219+ ISP and datacenter proxies, the exit IP is stable, so a successful check
220+ reliably indicates that subsequent browser sessions will reach the target site
221+ with the same IP. For residential and mobile proxies, the exit node changes
222+ between requests, so a successful check validates proxy configuration but does
223+ not guarantee that a subsequent browser session will use the same exit IP or
224+ reach the same site — it is useful for verifying credentials and connectivity,
225+ not for predicting site-specific behavior.
226+
209227 extra_headers: Send extra headers
210228
211229 extra_query: Add additional query parameters to the request
@@ -218,6 +236,7 @@ def check(
218236 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
219237 return self ._post (
220238 path_template ("/proxies/{id}/check" , id = id ),
239+ body = maybe_transform ({"url" : url }, proxy_check_params .ProxyCheckParams ),
221240 options = make_request_options (
222241 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
223242 ),
@@ -394,17 +413,35 @@ async def check(
394413 self ,
395414 id : str ,
396415 * ,
416+ url : str | Omit = omit ,
397417 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
398418 # The extra values given here take precedence over values defined on the client or passed to this method.
399419 extra_headers : Headers | None = None ,
400420 extra_query : Query | None = None ,
401421 extra_body : Body | None = None ,
402422 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
403423 ) -> ProxyCheckResponse :
404- """
405- Run a health check on the proxy to verify it's working.
424+ """Run a health check on the proxy to verify it's working.
425+
426+ Optionally specify a URL
427+ to test reachability against a specific target. For ISP and datacenter proxies,
428+ this reliably tests whether the target site is reachable from the proxy's stable
429+ exit IP. For residential and mobile proxies, the exit node varies between
430+ requests, so this validates proxy configuration and connectivity rather than
431+ guaranteeing site-specific reachability.
406432
407433 Args:
434+ url: An optional URL to test reachability against. If provided, the proxy check will
435+ test connectivity to this URL instead of the default test URLs. Only HTTP and
436+ HTTPS schemes are allowed, and the URL must resolve to a public IP address. For
437+ ISP and datacenter proxies, the exit IP is stable, so a successful check
438+ reliably indicates that subsequent browser sessions will reach the target site
439+ with the same IP. For residential and mobile proxies, the exit node changes
440+ between requests, so a successful check validates proxy configuration but does
441+ not guarantee that a subsequent browser session will use the same exit IP or
442+ reach the same site — it is useful for verifying credentials and connectivity,
443+ not for predicting site-specific behavior.
444+
408445 extra_headers: Send extra headers
409446
410447 extra_query: Add additional query parameters to the request
@@ -417,6 +454,7 @@ async def check(
417454 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
418455 return await self ._post (
419456 path_template ("/proxies/{id}/check" , id = id ),
457+ body = await async_maybe_transform ({"url" : url }, proxy_check_params .ProxyCheckParams ),
420458 options = make_request_options (
421459 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
422460 ),
0 commit comments