mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
feat(03b): add BYO custom proxy provider + bounded crawler rotation-retry
Add CustomProxyProvider (single endpoint or rotating pool via Scrapling ProxyRotator), registered as 'custom' alongside anonymous_proxies and selectable via PROXY_PROVIDER. Adds is_pool_backed to the ProxyProvider ABC + a zero-arg package helper. The web crawler does a bounded one-per-tier is_proxy_error rotation-retry gated on is_pool_backed() (single-endpoint providers no-op). Config/.env.example gain CUSTOM_PROXY_URL(S). Zero-arg getter contract unchanged for all consumers. Documents the proprietary boundary test (generic proxy infra stays Apache-2). Tests: provider, registry, crawler rotation (16). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5c36cd3071
commit
62260125f7
12 changed files with 358 additions and 4 deletions
|
|
@ -25,6 +25,14 @@ def get_requests_proxies() -> dict[str, str] | None:
|
|||
return get_active_provider().get_requests_proxies()
|
||||
|
||||
|
||||
def is_pool_backed() -> bool:
|
||||
"""Whether the active provider rotates across a client-side pool of endpoints.
|
||||
|
||||
The crawler gates its bounded proxy-error rotation-retry on this.
|
||||
"""
|
||||
return get_active_provider().is_pool_backed
|
||||
|
||||
|
||||
def get_residential_proxy_url() -> str | None:
|
||||
"""Backward-compatible alias for :func:`get_proxy_url`."""
|
||||
return get_proxy_url()
|
||||
|
|
@ -37,4 +45,5 @@ __all__ = [
|
|||
"get_proxy_url",
|
||||
"get_requests_proxies",
|
||||
"get_residential_proxy_url",
|
||||
"is_pool_backed",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue