python 指定证书验证_关于 Python 3.6 及以上发送 HTTPS 请求的证书验证问题

在Python 3.6及以上版本中,由于默认不再使用系统证书,通过HTTPS请求可能会遇到证书验证失败的问题。解决办法包括运行安装目录下的Install Certificates.command脚本,或者在代码中导入certifi并指定cafile参数。不推荐使用不验证SSL证书的方法,因为这可能带来安全隐患。
摘要由CSDN通过智能技术生成

macOS 10.12.5

在 Python 3.6 及以上的版本中,直接发送 HTTPS 请求,会出现以下问题

[SSL: CERTIFICATE_VERIFY_FAILED]

这个问题兜一圈才注意到 Python 安装目录下 ReadMe.rtf 中说明了这个问题

Certificate verification and OpenSSL

****NEW**** This variant of Python 3.6 now includes its own private copy of OpenSSL 1.0.2. Unlike previous releases, the deprecated Apple-supplied OpenSSL libraries are no longer used. This also means that the trust certificates in system and user keychains managed by the *Keychain Access *application and the security command line utility are no longer used as defaults by the Python ssl module. For 3.6.0, a sample command script is included in /Applications/Python 3.6 to install a curated bundle of default root certificates from the third-party certifi package (https://pypi.python.org/pypi/certifi). If you choose to use certifi, you should consider subscribing to the project's email update service to be notified when the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值