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=5,
    smartproxy_backoff_factor=1.5,
    smartproxy_timeout=10,
)

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.0

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.0
File Size Uploaded
cloud_proxy_hub-0.1.0.tar.gz 15.5 kB Details

Built distribution (wheel)

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

Total release size: 35.2 kB

Release files / cloud_proxy_hub-0.1.0.tar.gz

Download URL cloud_proxy_hub-0.1.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0fee1497cc064c6ddd177a36d25d264f30a0922fdcd3bacf5bf00d83ec2aadfa
BLAKE2b-256 checksum
How to use checksums
dc26c802d3f4ef1fe1dfe4bb08b19e153cc9259733bf58fcea60f2a0ce8d8b75
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.0-py3-none-any.whl

Download URL cloud_proxy_hub-0.1.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc0cabd9dd242ace031e9800c8768e11521005eb8c644365972bdb116ca13ae1
BLAKE2b-256 checksum
How to use checksums
9fbcd0bfef5033d0998b286b4b277ac8773cb41f126e3789293b8705dce73444
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

0.1.1

2 release files

This release

0.1.0 This release

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