Skip to main content

ProxyRequest Python SDK

CI PyPI Python

Official synchronous and asynchronous Python client for the ProxyRequest public API. It covers all 82 operations in the current contract: users, orders, proxy generation, analytics, invoices, packages, locations, webhooks, API keys, Telegram integration, and more.

What is ProxyRequest?

ProxyRequest is a white-label proxy platform for operators and resellers that already have upstream proxy supply. It provides the product and control layer needed to turn that supply into a customer-facing service:

  • managed HTTP, HTTPS, SOCKS5, and SOCKS5h gateways;
  • packages, users, orders, proxy credentials, limits, and byte accounting;
  • geographic and network targeting, sticky sessions, and multi-provider routing;
  • customer and reseller dashboards, invoices, coupons, and payment flows;
  • analytics, signed webhooks, API keys, and operational reporting.

You can use the complete managed backend and customer dashboard, or keep your own frontend, identity, and billing while ProxyRequest handles provisioning, routing, accounting, and analytics headlessly. You retain your brand, pricing, customer relationships, and upstream provider contracts.

ProxyRequest is not an upstream bandwidth plan. Provider traffic and contracts remain separate from the platform subscription. See the platform overview for the complete operating boundary.

How this SDK fits

The REST API is the control plane around proxy traffic. This SDK provisions resources and reads their state; customer proxy requests go to the managed gateway servers instead of passing through the SDK or REST API.

Your Python backend ── HTTPS/JSON ──> ProxyRequest API
Customer traffic ───── HTTP/SOCKS ──> Managed gateways ──> Destination

Keep the credentials for those paths separate: API keys belong only in trusted backend code, while generated proxy usernames and passwords are supplied only to the customer or workload that connects to a gateway.

The most important resource relationships are:

Customer purchase:
Package -> Invoice -> Paid invoice -> Order / data ledger -> Proxy credentials

Reseller provisioning:
Eligible root order -> Sub-user + child allocation -> Proxy credentials

Invoices describe commercial state. Orders and data ledgers describe service entitlement. Creating an invoice or returning from checkout is therefore not proof that proxy access is active.

Choose an integration path

Scenario Recommended flow
Built-in customer checkout Select a package, create an invoice, obtain its payment link, confirm payment and entitlement, then generate proxy credentials.
Reseller-managed customer Create a sub-user, assign a package and byte limit from an eligible root order, then generate credentials for that user.
Existing headless platform Keep your own customer and billing records, persist mappings to ProxyRequest users/packages/orders, and provision through the API.

See purchase a package with an invoice and provision a reseller customer for complete Python examples.

Installation

python -m pip install proxyrequest-sdk

Python 3.11 or newer is required. The package uses httpx and includes both sync and async clients.

Quick start

import os

from proxyrequest_sdk import Client
from proxyrequest_sdk.models import UserCreateRequest

with Client.with_api_key(os.environ["PROXYREQUEST_API_KEY"]) as client:
    profile = client.profile.get()
    user = client.users.create(
        body=UserCreateRequest(
            username="customer-reference",
            password=os.urandom(32).hex(),
        )
    )
    print(profile.username, user.id)

Static API keys are sent as Authorization: Static YOUR_API_KEY. Never expose them to browser code.

The asynchronous API has the same resource and method names:

import os

from proxyrequest_sdk import AsyncClient


async def list_users() -> None:
    async with AsyncClient.with_api_key(os.environ["PROXYREQUEST_API_KEY"]) as client:
        page = await client.users.list(limit=100)
        for user in page.results:
            print(user.username)

Resource API

Client and AsyncClient expose one object per API group:

client.authorization
client.users
client.profile
client.orders
client.proxies
client.analytics
client.invoices
client.coupons
client.rewards
client.affiliates
client.packages
client.locations
client.api_keys
client.webhooks
client.telegram
client.telegram_service
client.sessions
client.settings
client.news

All operation parameters and return values are typed. Request and response models live in proxyrequest_sdk.models, use snake_case attributes, and expose to_dict() / from_dict() helpers. IDs follow their OpenAPI type (UUID or opaque str), and all byte amounts are Python integers.

See the generated API resource reference and model reference.

Pagination

List endpoints return their typed OpenAPI page. Use paginate() to follow all pages lazily:

with Client.with_api_key(os.environ["PROXYREQUEST_API_KEY"]) as client:
    for user in client.paginate(client.users.list, limit=100):
        print(user.username)

The asynchronous variant is also lazy:

async with AsyncClient.with_api_key(os.environ["PROXYREQUEST_API_KEY"]) as client:
    async for user in client.paginate(client.users.list, limit=100):
        print(user.username)

Errors

Every documented and undocumented HTTP failure is normalized to ApiError. Network and decoding problems use the same contract:

from proxyrequest_sdk import ApiError, ErrorKind

try:
    client.profile.get()
except ApiError as error:
    if error.kind is ErrorKind.AUTHENTICATION:
        # Replace the invalid API key or bearer token.
        pass
    print(error.status_code, error.request_id, error.field_errors)

The SDK does not automatically retry writes or refresh JWTs. Call client.authorization.refresh(...) explicitly when your application owns a token pair.

Configuration and custom deployments

import httpx

client = Client.with_api_key(
    os.environ["PROXYREQUEST_API_KEY"],
    base_url="https://customer-api.example/api/v1",
    language="uk",
    timeout=20,
    connect_timeout=5,
)

An existing httpx.Client or httpx.AsyncClient can be supplied through http_client. It must have the same base_url; the SDK applies its auth, language, and user-agent headers but leaves closing the external client to the caller. The request() method is an authenticated escape hatch for endpoints introduced before the next SDK release.

Invoice downloads

download = client.download_invoice_pdf(invoice_id)
path = download.save(f"./{download.filename}")
print(path, download.content_type)

save() does not overwrite an existing file unless overwrite=True is passed.

Telegram service operations

Account-side Telegram operations use the client's API key. Bot service operations require the service secret explicitly and never reuse the ordinary Authorization header:

from proxyrequest_sdk.models import TelegramSessionRequest

session = client.telegram_service.create_session(
    body=TelegramSessionRequest(telegram_user_id=123456789, chat_id=123456789),
    service_secret=os.environ["PROXYREQUEST_TELEGRAM_SECRET"],
)

Webhook verification

Verify the exact raw body before decoding it:

from proxyrequest_sdk import WebhookVerifier

payload = WebhookVerifier.decode_verified_json(
    raw_body,
    request.headers.get("X-Webhook-Signature", ""),
    os.environ["PROXYREQUEST_WEBHOOK_SECRET"],
    timestamp_header=request.headers.get("X-Webhook-Timestamp"),
)

Platform documentation

Development

uv sync --all-groups
make quality
make generate-check
make build

The vendored schema is pinned in openapi/source.json. Run make sync-openapi SOURCE=/path/to/openapi.yml, followed by make generate, to update it. Generation is pinned and CI rejects uncommitted contract changes.

License

MIT

Download files

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

Source Distribution

proxyrequest_sdk-1.0.0.tar.gz (264.4 kB view details)

Uploaded Source

Built Distribution

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

proxyrequest_sdk-1.0.0-py3-none-any.whl (664.2 kB view details)

Uploaded Python 3

File details

Details for the file proxyrequest_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: proxyrequest_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 264.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for proxyrequest_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 338cabeb2067a4345854e0fe3346ff11187637983b88e14a4d1e61736a8cd6c7
MD5 d866def385ea481e8f40b825dd23578b
BLAKE2b-256 9e1df77f25e4eec372a90a6cc3903d32ede421b7f48336c407b76be31319dc74

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxyrequest_sdk-1.0.0.tar.gz:

Publisher: release.yml on proxyrequest/python-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 proxyrequest_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for proxyrequest_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8b40fb96ef2cfe015c80c24fb1a5548f4cd0a5b0d3263a4ea5933278c3d8231
MD5 4d63e00c98b015aa5079929353b9aff7
BLAKE2b-256 31f3f890ca806fccec1027154dd745fd60302070e3da9b315eb0991da9f0f10c

See more details on using hashes here.

Provenance

The following attestation bundles were made for proxyrequest_sdk-1.0.0-py3-none-any.whl:

Publisher: release.yml on proxyrequest/python-sdk

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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

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