Skip to main content

Unofficial Python SDK for the Proxy6.net API

Project description

proxy6-sdk

CI codecov PyPI version Python 3.13+ License: MIT

Unofficial — this project is a community-built client for Proxy6.net and is not affiliated with, endorsed by, or supported by Proxy6.net. All trademarks belong to their respective owners.

A typed Python SDK for the Proxy6.net API.

Covers all nine documented endpoints — getprice, getcount, getcountry, getproxy, setdescr, buy, prolong, delete, check — plus the keyless account call. Responses are parsed into dataclasses with proper types (datetime, int, bool, enums) instead of the raw strings the API returns.

Status: alpha (0.1.0a1). The public API may change before 0.1.0. See CHANGELOG.md for what shipped.

Install

uv add proxy6-sdk
# or
pip install proxy6-sdk

The distribution name is proxy6-sdk; the import name is proxy6:

from proxy6 import Proxy6Client

Requires Python 3.13+.

Quick start

from proxy6 import Proxy6Client, Version

# Pass the key explicitly...
with Proxy6Client(api_key="YOUR_KEY") as client:
    ...

# ...or set PROXY6_API_KEY in the environment and omit it.
with Proxy6Client() as client:
    info = client.account()
    print(f"Balance: {info.balance} {info.currency}")

    # How much for 10 Russian IPv6 proxies for 30 days?
    quote = client.get_price(count=10, period=30, version=Version.IPV6)
    print(quote.price, quote.price_single)

    # Buy them
    order = client.buy(
        count=10,
        period=30,
        country="ru",
        version=Version.IPV6,
        descr="scraper-pool",
    )
    for proxy in order.proxies:
        print(proxy.auth_url())  # http://user:pass@host:port

API surface

Method Purpose
account() Balance / currency (calls API with no method)
get_price(count?, period?, version?) Single-quote or full price table
get_count(country, version?) Available stock for a country
get_country(version) List of ISO2 codes for a version
get_proxy(state?, descr?, page?, limit?) List your proxies
set_descr(new, old?, ids?) Rename the technical comment
buy(count, period, country, version, descr?, ...) Purchase proxies
prolong(period, ids) Extend existing proxies
delete(ids?, descr?) Delete by id or by comment
check(ids?, proxy?) Liveness check via id or ip:port:user:pass

Authentication

The client resolves the API key in this order:

  1. The api_key= constructor argument
  2. The PROXY6_API_KEY environment variable

If neither is set, Proxy6Client() raises ValueError. The SDK does not load .env files itself — if you keep your key in .env, use python-dotenv in your application:

from dotenv import load_dotenv
from proxy6 import Proxy6Client

load_dotenv()
client = Proxy6Client()

Enums

from proxy6 import Version, State, ProxyType

Version.IPV4_SHARED  # 3
Version.IPV4         # 4
Version.MTPROTO      # 5
Version.IPV6         # 6

State.ACTIVE | State.EXPIRED | State.EXPIRING | State.ALL
ProxyType.HTTP | ProxyType.SOCKS

Errors

The API uses an envelope of {"status":"no","error_id":N,"error":"..."}. Each documented error code has its own exception subclass, so you can catch specific failures directly:

from proxy6 import (
    InsufficientBalanceError,
    NotEnoughProxiesError,
    Proxy6APIError,
)

try:
    client.buy(count=100, period=30, country="ru", version=Version.IPV6)
except InsufficientBalanceError:
    topup()
except NotEnoughProxiesError:
    wait_and_retry()
except Proxy6APIError as e:
    # Catch-all for anything else
    log.error("proxy6 %s: %s", e.error_id, e.error)
Code Exception Meaning
30 UnknownError Unknown error
100 AuthError Wrong API key
105 IPNotAllowedError IP restriction blocked the call
110 MethodError Wrong method name
200 InvalidCountError Bad proxies quantity
210 InvalidPeriodError Bad period (days)
220 InvalidCountryError Bad country code
230 InvalidIdsError Bad proxy id list
240 InvalidVersionError Bad proxy version
250 InvalidDescriptionError Bad technical description
260 InvalidProxyTypeError Bad proxy type/protocol
270 InvalidPortError Bad port
280 InvalidProxyStringError Bad ip:port:user:pass for check
300 NotEnoughProxiesError Stock too low
400 InsufficientBalanceError Zero / low balance
404 NotFoundError Element not found
410 PriceCalculationError Cost ≤ 0

The raw documented messages are also exposed as the proxy6.ERROR_CODES dict.

Rate limiting

The API allows 3 requests per second; over that limit it returns HTTP 429. The SDK ships with a thread-safe sliding-window limiter that all Proxy6Client instances share by default, so you don't have to think about it — concurrent calls just block long enough to stay under the cap.

from proxy6 import Proxy6Client, RateLimiter

# Default — uses the process-wide DEFAULT_RATE_LIMITER (3/s).
client = Proxy6Client()

# Custom limit (e.g. you have a higher-tier agreement).
client = Proxy6Client(rate_limiter=RateLimiter(max_requests=10, period=1.0))

# Disable entirely (you're handling throttling yourself).
client = Proxy6Client(rate_limiter=None)

Using a custom session

Inject any requests.Session (e.g. with retry policies or a proxy of your own):

import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

session = requests.Session()
session.mount("https://", HTTPAdapter(max_retries=Retry(
    total=5, backoff_factor=0.5, status_forcelist=(429, 500, 502, 503, 504)
)))
client = Proxy6Client(api_key="...", session=session)

Development

uv sync
uv run pytest                    # unit tests only (integration is gated)
uv run pytest -m integration     # hit the real API; needs PROXY6_API_KEY

Put your key in a local .env; tests/conftest.py loads it automatically.

User-visible changes are tracked in CHANGELOG.md — add an entry under [Unreleased] whenever you ship something that affects the public API.

License

MIT — see LICENSE. This is an unofficial project and ships with no warranty of fitness for any particular purpose.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxy6_sdk-0.1.0a1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxy6_sdk-0.1.0a1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file proxy6_sdk-0.1.0a1.tar.gz.

File metadata

  • Download URL: proxy6_sdk-0.1.0a1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for proxy6_sdk-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 485bb924936937d0b0a366a00076d5ab05a4ab8077f6199568c67a919baf31fa
MD5 a57dd839d8a561dca13c320cdea1a859
BLAKE2b-256 ba6ada8003cf218df3d3e8a1b41f950d0f0e35f51bec6c3fd863eed2cdc115c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxy6_sdk-0.1.0a1.tar.gz:

Publisher: release.yml on AsyncAlchemist/proxy6-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file proxy6_sdk-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: proxy6_sdk-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for proxy6_sdk-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 023dc02d8166500bff219c1ff1d5a56d1200c851cb62b8834a3a4e23cd3398f7
MD5 142365743e1555d476a9b525cc6335c9
BLAKE2b-256 cf163004f769bd853468f8cfedbc16bfcf6638c0b23e771a39872f1764d7cd22

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxy6_sdk-0.1.0a1-py3-none-any.whl:

Publisher: release.yml on AsyncAlchemist/proxy6-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page