Python Library to use a list of proxy in httpx.AsyncClient
- python >= 3
- httpx >= 0.22.0
python -m pip -U install git+https://github.com/andreyzin/httpx_rotating_proxy.git
- Not available on PyPi now
- List of proxies
from httpx_rotating import RotatingProxyTransport
proxy_list = [
"socks5://127.0.0.1:8000",
"https://127.0.0.1:80"
]
transport = RotatingProxyTransport(proxy_list)
client = httpx.AsyncClient(transport=transport)
- Factory
from httpx_rotating import RotatingProxyTransport
proxy_list = [
"socks5://127.0.0.1:8000",
"https://127.0.0.1:80"
]
transport = RotatingProxyTransport(lambda x: random.choice(proxy_list))
client = httpx.AsyncClient(transport=transport)
- factory signature:
Callable[[httpcore.Origin], Union[ProxyTypes, RawProxy]]
This project is licensed under the MIT License - see the LICENSE file for details