HX
Languages & HTTP Clients

Python (HTTPX) proxy integration

HTTPX is the modern async HTTP client for Python and supports proxies natively for both sync and async code. Point it at your Aethyn endpoint to run high-concurrency residential requests with asyncio.

Setup steps

  1. 1Install HTTPX: pip install httpx (add httpx[socks] for SOCKS5).
  2. 2Pass the Aethyn proxy URL to the proxy argument.
  3. 3Use AsyncClient for concurrent residential requests.
  4. 4Add targeting suffixes to the username as needed.

Code

Async HTTPX client
import asyncio, httpx

proxy = "http://aethyn-XXXXX-country-us:PASSWORD@proxy.aethyn.io:2099"

async def main():
    async with httpx.AsyncClient(proxy=proxy, timeout=30) as client:
        r = await client.get("https://httpbin.org/ip")
        print(r.json())

asyncio.run(main())
SOCKS5 with HTTPX
import httpx

proxy = "socks5://aethyn-XXXXX:PASSWORD@proxy.aethyn.io:1099"
with httpx.Client(proxy=proxy, timeout=30) as client:
    r = client.get("https://httpbin.org/ip")
    print(r.json())

Replace aethyn-XXXXX and PASSWORD with your dashboard credentials. See the full targeting reference and protocol/port list.

Tips

  • Use AsyncClient + asyncio.gather to fan out many residential requests.
  • Install httpx[socks] before using the socks5:// scheme.
  • Reuse a single client instance to pool connections.

Python (HTTPX) proxy FAQ

Does HTTPX support async proxies?
Yes. HTTPX's AsyncClient accepts the same proxy argument, so you can run high-concurrency residential requests under asyncio.

Ready to wire up Python (HTTPX)?

Get your credentials and route your first Python (HTTPX) request through residential IPs in minutes.

Docs, solutions & blog

Related integrations

All integrations