如何在aiohttp ClientSession中使用SOCKS4和SOCKS5代理?需要一些小例子。谢谢!
答案 0 :(得分:2)
你试过aiosocks吗?
import asyncio
import aiosocks
from aiosocks.connector import SocksConnector
conn = SocksConnector(proxy=aiosocks.Socks5Addr(PROXY_ADDRESS, PROXY_PORT), proxy_auth=None, remote_resolve=True)
session = aiohttp.ClientSession(connector=conn)
async with session.get('http://python.org') as resp:
assert resp.status == 200