Overview
HTTPX 0.27, released on February 22, 2024, improves connection pool management and adds SOCKS proxy support.
Main Features
Connection pool
The connection pool is optimized with better HTTP/2 connection reuse and finer limit control.
python
import httpx
# Configured connection pool
limits = httpx.Limits(
max_connections=100,
max_keepalive_connections=20,
)
async with httpx.AsyncClient(limits=limits) as client:
response = await client.get('https://httpbin.org/get')
print(response.status_code) # 200
SOCKS support
HTTPX supports SOCKS4 and SOCKS5 proxies via the socksio package, enabling routing through Tor or VPNs.
python
import httpx
# pip install httpx[socks]
client = httpx.Client(
proxy='socks5://127.0.0.1:1080',
)
response = client.get('https://httpbin.org/ip')
print(response.json()) # proxy IP
client.close()
