Python proxy SDK
A tiny, dependency-free Python SDK for aethyn.io residential proxies. Build correct proxy URLs with country / city / sticky-session / lifetime targeting and hand them straight to requests, httpx, Playwright, or Selenium — without hand-assembling fragile username strings.
Install
Add proxy-builder-sdk to your project.
pip install proxy-builder-sdkThe SDK picks the correct port from your tier and protocol automatically.
| Tier | HTTP | SOCKS5 |
|---|---|---|
| Premium | 2099 | 1099 |
| Elite | 5499 | 3499 |
White-label? Pass host: "gate.example.com" to the client constructor.
Usage
Copy-paste examples for common patterns.
import requests
from proxy_builder_sdk import AethynClient
client = AethynClient(username="aethyn-XXXXX", password="PASSWORD")
# or set AETHYN_USERNAME / AETHYN_PASSWORD
p = client.proxy(country="us")
r = requests.get("https://api.ipify.org?format=json", proxies=p.proxies)
print(r.json())p = client.session(country="de", session="cart42", ttl=10) # same IP for 10 min
# p.username -> "aethyn-XXXXX-country-de-session-cart42-lifetime-10"- ttl is minutes (1–1440).
- Leave session off for per-request rotation (the default).
p = client.session(
country="us", city="chicago", isp="comcast",
session="run1", ttl=30, tier="elite",
)
# city, state, isp, and zip are Elite-only — SDK raises a clear error if you pass them on Premiumimport httpx
p = client.proxy(country="gb")
with httpx.Client(proxy=p.url) as http:
http.get("https://example.com")from playwright.sync_api import sync_playwright
p = client.session(country="fr", session="s1", ttl=15, tier="elite")
with sync_playwright() as pw:
browser = pw.chromium.launch(proxy=p.for_playwright())
# ...p = client.proxy(country="jp", protocol="socks5")
# socks5://...@proxy.aethyn.io:1099# pip install selenium-wire
from seleniumwire import webdriver
p = client.proxy(country="us")
options = {"proxy": {"http": p.url, "https": p.url}}
driver = webdriver.Chrome(seleniumwire_options=options)p = client.session(country="us", session="run1", ttl=10)
p.username # "aethyn-XXXXX-country-us-session-run1-lifetime-10"
p.host, p.port # ("proxy.aethyn.io", 2099)
p.url # "http://aethyn-XXXXX-...:PASSWORD@proxy.aethyn.io:2099"
p.proxies # {"http": ..., "https": ...}
p.for_playwright() # {"server": ..., "username": ..., "password": ...}
str(p) # password-redacted, safe to logOther providers
Aethyn is the default, but the same clean API drives other big residential providers too — use ProxyClient with a provider:
from proxy_builder_sdk import ProxyClient
# Oxylabs — the SDK emits customer-...-cc-us-sessid-run1-sesstime-10
p = ProxyClient(username="customer-me", password="pw", provider="oxylabs").session(
country="us", session="run1", ttl=10
)| Provider | Gateway | Notes |
|---|---|---|
| aethyn (default) | proxy.aethyn.io | Premium/Elite tiers, city/ISP/state/zip |
| brightdata | brd.superproxy.io | pass brd-customer-<id>-zone-<zone> as the username |
| oxylabs | pr.oxylabs.io | cc/sessid/sesstime; state as us_california |
| smartproxy / decodo | gate.decodo.com | sessionduration (minutes) |
| iproyal | geo.iproyal.com | targeting goes in the password |
| soax | proxy.soax.com | ⚠️ community-verified; lifetime in seconds |
| netnut | gw.netnut.net | country + sticky session only |
Every non-Aethyn dialect was verified against the provider's official docs (each provider file records the source URL and a confidence level). SOAX is medium confidence — sanity-check it against SOAX's current docs before you lean on it. Each provider maps the same semantic call (country, city, state, session, ttl) to its own username/password format and throws a clear error for anything it can't express.
- Set AETHYN_USERNAME and AETHYN_PASSWORD env vars instead of hardcoding credentials.
- str(p) is safe to log — the password is redacted.
- Self-hosting or white-labeling? Pass host="gate.example.com" to the client constructor.
FAQ
Do I need the SDK to use Aethyn?
Which port does the SDK pick?
Can I use city or ISP targeting on Premium?
What is the ttl range for sticky sessions?
Does it work with Scrapy?
Does it support other proxy providers?
Docs, integrations & blog
License: MIT