aiohttp.client_exceptions.ClientConnectorError:无法连接到主机stackoverflow.com:443ssl:default [连接呼叫失败(&#039

aiohttp.client_exceptions.ClientConnectorError:无法连接到主机stackoverflow.com:443ssl:default [连接呼叫失败(&#039,第1张

aiohttp.client_exceptions.ClientConnectorError:无法连接到主机stackoverflow.com:443ssl:default [连接呼叫失败('

引用论坛的帮助,我

trust_env= True
在创建客户端时添加了该链接,现在一切正常。这是新代码:

import asyncioimport aiohttpasync def main():    loop = asyncio.get_event_loop()    url = "https://stackoverflow.com/"    async with aiohttp.ClientSession(loop=loop, trust_env=True) as session:        async with session.get(url, timeout=30) as resp: print(resp.status)asyncio.run(main())


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5629634.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存