代码如下: import aiohttp import ssl import certifi import asyncio user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36' headers={ 'user_agent':user_agent }
async def test(): async with aiohttp.ClientSession() as session: async with session.get(url='https://www.facebook.com/',headers=headers,) as response: print(await response.text()) loop=asyncio.get_event_loop() loop.run_until_complete(test()) 出现如下报错: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.facebook.com:443 ssl:default [信号灯超时时间已到] 网上搜索说将 verify_ssl=Fals 或者添加 cOnnector=aiohttp.TCPConnector(limit=50, loop=loop) 还是一样出错
![]() | 1 2033009565 OP 重新排版 |
![]() | 2 2033009565 OP 排版好重新发 |
![]() | 3 est 2020-08-13 16:44:52 +08:00 ssl:default [信号灯超时时间已到] 建议联系信号灯生产厂家售后。 |
![]() | 4 2033009565 OP |
![]() | 5 2033009565 OP 网上搜索说将 verify_ssl=Fals 或者添加 cOnnector=aiohttp.TCPConnector(limit=50, loop=loop) 还是一样出错 |
![]() | 我试了下没啥问题,先确认下终端是否可以直接 ping 通 |
![]() | 7 2033009565 OP @junnplus 大佬 ,我这边 ping 的时候显示超时,但网页是可以正常访问的,这和我使用的 vpn 有关吗? |
![]() | 8 junnplus 2020-08-14 14:52:19 +08:00 @2033009565 你可能需要设置 aiohttp 的代理 |
![]() | 9 2033009565 OP @junnplus 好的 谢谢 我去试试 |