ClientConnectorCertificateError(ConnectionKey(host='www.xxxx.org', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=-612960990), SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)'))
发生证书验证错误
使用aiohttp
发送网络请求时设置了verify
参数为False
。错误信息"TypeError: _request() got an unexpected keyword argument 'verify'",当前使用的aiohttp
版本中,ClientSession.get()
方法不接受verify
参数。
使用aiohttp
时禁用SSL证书验证,使用自定义的TCPConnector
并将其传递给ClientSession
。
#核心代码
async def down_one(url):
print(url)
conn = aiohttp.TCPConnector(ssl=False)
async with aiohttp.ClientSession(connector=conn) as s:
# 发送网络请求
async with s.get(url,headers=header) as re:
print(2)