MCPcopy Create free account
hub / github.com/apify/crawlee-python / _is_proxy_error

Method _is_proxy_error

src/crawlee/http_clients/_httpx.py:340–352  ·  view source on GitHub ↗

Determine whether the given error is related to a proxy issue. Check if the error is an instance of `httpx.ProxyError` or if its message contains known proxy-related error keywords.

(error: httpx.TransportError)

Source from the content-addressed store, hash-verified

338
339 @staticmethod
340 def _is_proxy_error(error: httpx.TransportError) -> bool:
341 """Determine whether the given error is related to a proxy issue.
342
343 Check if the error is an instance of `httpx.ProxyError` or if its message contains known proxy-related
344 error keywords.
345 """
346 if isinstance(error, httpx.ProxyError):
347 return True
348
349 if any(needle in str(error) for needle in ROTATE_PROXY_ERRORS): # noqa: SIM103
350 return True
351
352 return False
353
354 async def cleanup(self) -> None:
355 for client in self._client_by_proxy_url.values():

Callers 2

crawlMethod · 0.95
send_requestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected