Proxy (HTTP, SOCKS) transports for httpx
Project description
httpx-socks
Proxy transports for httpx client. SOCKS4(a), SOCKS5, HTTP (tunneling) proxy supported.
Requirements
- Python >= 3.6
- httpx >= 0.13.3
- async-timeout>=3.0.1
Installation
pip install httpx-socks
Usage
sync transport
import httpx
from httpx_socks import SyncProxyTransport
def fetch(url):
transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')
with httpx.Client(transport=transport) as client:
res = client.get(url)
return res.text
async transport (both asyncio and trio supported)
import httpx
from httpx_socks import AsyncProxyTransport
async def fetch(url):
transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')
async with httpx.AsyncClient(transport=transport) as client:
res = await client.get(url)
return res.text
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
httpx-socks-0.2.3.tar.gz
(16.1 kB
view hashes)
Built Distribution
Close
Hashes for httpx_socks-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f040d8c968e52f4add571a2453eb5baa03d8980b0b0be37539e1a16974675179 |
|
MD5 | 81e5f84b4f7f1e71d7a7fc934ac7c634 |
|
BLAKE2b-256 | 857b7f038ce6131bac0a4a8611417591e2d2f7fe9b9e253afb0363bd6d337218 |