Skip to main content

cloud-proxy-hub

Multi-provider proxy pool with geo and performance validation. Wraps Proxy-Seller (datacenter + residential), SmartProxy (residential) and pingnetwork.io (residential, secondary) behind a single class:

from cloud_proxy_hub import ProxyHub, ProxyHubConfig

config = ProxyHubConfig(
    # provider credentials — or leave unset and export the same-named
    # env vars (PROXY_API_KEY, SMARTPROXY_LOGIN, SMARTPROXY_PASS, ...)
    proxy_api_key="...",
    proxy_seller_res_login="...",
    proxy_seller_res_pass="...",
    proxy_pingnetwork_res_login="...",
    proxy_pingnetwork_res_pass="...",
    smartproxy_login="...",
    smartproxy_pass="...",

    # extra static datacenter proxies per ISO-3166 alpha-2 country code
    # (used to be hardcoded in the library — now it's yours to supply)
    additional_datacenter_proxies={
        "ZA": ["http://user:pass@host:port", ...],
        "BR": ["http://user:pass@host:port", ...],
    },

    # which providers are active, and in what order (default shown here —
    # SmartProxy is OFF by default; add it back with any key/priority to
    # re-enable, e.g. provider_priority={"Proxy-Seller": 1, "SmartProxy": 2, "pingnetwork": 3}).
    # Drop "pingnetwork" too if you don't want the pingnetwork.io fallback.
    provider_priority={"Proxy-Seller": 1, "pingnetwork": 2},

    # tuning knobs, passed the same way at startup — shown with their defaults
    proxy_seller_weight=90,     # % of residential traffic via proxy-seller.com
    pingnetwork_weight=10,      # % via pingnetwork.io

    # smartproxy_retries / smartproxy_backoff_factor / smartproxy_timeout
    # also exist (defaults 5 / 1.5 / 10) — omitted here since SmartProxy is
    # off by default above; only relevant once you add "SmartProxy" back to
    # provider_priority.
)

proxy_hub = ProxyHub(validate_proxies=True, config=config)

proxy = proxy_hub.provide_valid_proxies(
    proxy_type="residential",
    country_code="DE",
    neighbor_geo_enable=False,
    reverse_proxy=is_last_attempt,  # force pingnetwork.io on the last retry
)

Everything you need to tune lives on ProxyHubConfig — construct it once, pass it to ProxyHub, and call provide_valid_proxies(). No need to reach into cloud_proxy_hub.providers / cloud_proxy_hub.geo / cloud_proxy_hub.performance unless you're extending the library itself.

Why a config object

The original script read paths and provider credentials from an internal src.settings module, and had a dict of extra datacenter proxies (with real login/password pairs) hardcoded in the class body. Both made the code impossible to hand to anyone outside that one codebase, and unsafe to publish anywhere public. ProxyHubConfig replaces both: every credential is either passed explicitly or read from an environment variable of the same name, and additional_datacenter_proxies is supplied by the caller instead of baked into the source.

Install

pip install cloud-proxy-hub

Published on public PyPI. No credentials are embedded anywhere in the source — every secret is supplied by the consumer via ProxyHubConfig or environment variables, as shown above.

Publishing a new version

python -m pip install --upgrade build twine
python -m build          # produces dist/*.whl and dist/*.tar.gz
python -m twine upload dist/*

Requires a PyPI account with 2FA enabled and an API token (__token__ as username, the token as password).

Migrating from the old updated_proxy_hub.py

  • from src.settings import settings → build a ProxyHubConfig(...) once (from your own private settings) and pass it to ProxyHub(config=...).
  • The hardcoded ADDITIONAL_DATACENTER_PROXIES dict → pass it as ProxyHubConfig(additional_datacenter_proxies={...}).
  • The hardcoded proxy_priority module dict (which providers run, and in what order) → ProxyHubConfig(provider_priority={...}). Default is {"Proxy-Seller": 1, "pingnetwork": 2} — SmartProxy is off by default (still fully implemented in the library, just excluded from the default dict); add an "SmartProxy": <n> key to turn it back on, or drop "pingnetwork" to disable that too. Same membership check for all three — drop any key to disable that provider at startup instead of commenting it out in library source. Caveat: "pingnetwork" only runs from inside Proxy-Seller's residential lookup, so dropping "Proxy-Seller" disables pingnetwork too even if "pingnetwork" is still in the dict — see USAGE.md for details.
  • The hardcoded 90/10 provider split → proxy_seller_weight / pingnetwork_weight on ProxyHubConfig (defaults are still 90/10).
  • SmartProxy's hardcoded retries=5, backoff_factor=1.5, timeout=10 → smartproxy_retries / smartproxy_backoff_factor / smartproxy_timeout on ProxyHubConfig (same defaults).
  • ProxyHub(validate_proxies=...) and provide_valid_proxies(...) keep their original signature and behavior.

Release files for cloud-proxy-hub 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloud-proxy-hub 0.1.1
File Size Uploaded
cloud_proxy_hub-0.1.1.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloud-proxy-hub 0.1.1
File Interpreter ABI Platform
cloud_proxy_hub-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.4 kB

Release files / cloud_proxy_hub-0.1.1.tar.gz

Download URL cloud_proxy_hub-0.1.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1532f421bfecb5a1b707d8fa14caaac7c446d2331e0c8c39bc913d0324a0ea4a
BLAKE2b-256 checksum
How to use checksums
03badaa8fb8e2e14bbe42b8614f1feea4edde6cabf38d8cb59990c1fea8a0764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / cloud_proxy_hub-0.1.1-py3-none-any.whl

Download URL cloud_proxy_hub-0.1.1-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26cba173bedd847b5238f7f362922fb25edf715d73c6e76b7ccaa722e8ee1f4d
BLAKE2b-256 checksum
How to use checksums
d85ebca8ebc41bc94c477b916493b3ecc0232ada4c5be66b8b32a824b018651b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page