Is there any way to use aiohttp client with socks proxy?

Looks like aiohttp.ProxyConnector doesn't support socks proxy. Is there any workaround for this? I would be grateful for any advice.


你尝试过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
链接地址: http://www.djcxy.com/p/91574.html

上一篇: Android无法将FAB按钮锚定到BottomSheet

下一篇: 有什么办法可以用socks proxy来使用aiohttp客户端吗?