资讯专栏INFORMATION COLUMN

SSL3_GET_SERVER_CERTIFICATE 错误解决办法

MiracleWong / 2794人阅读

摘要:模块之前一直正常的,某一天开始对的请求都抛错误了完整的试过没效果,最后试了下面的起效的当然,还是有警告不够,至少可以先用着了。原因估计就是高版本的对证书验证更为严格了。

requests模块之前一直正常的,某一天开始对https的请求都抛错误了:
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
完整的:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 68, in get
    return request("get", url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

试过:

sudo apt-get install ca-certificates
sudo update-ca-certificates

没效果,
最后试了下面的起效的:

sudo pip uninstall -y certifi
sudo pip install certifi==2015.04.28

当然,还是有警告:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

不够,至少可以先用着了。原因估计就是高版本(2016.2.8)的certifi对证书验证更为严格了。

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/38005.html

相关文章

  • PHP composer 报错 certificate verify failed

    摘要:环境使用安装依赖的时候报错了出现了如下的错误描述是证书出现了一些问题尝试修复待全部软件更新后重启机器再次尝试来安装依赖成功了 环境: centos7 使用 composer 安装依赖的时候报错了. 出现了如下的错误描述: Failed to download laravel/laravel from dist: The https://files.phpcomposer.com/fil...

    psychola 评论0 收藏0
  • HTTP状态码趣味图解(下)

    摘要:多文件下载,改为单文件下载文件错误,短时间内导致程序崩溃。为喵点赞,收藏了。参考资料图片状态码 喵:铲屎的,你还在为HTTP状态码而苦恼码?本喵为你趣味解惑 5xx: 服务器错误,服务器在处理请求的过程中发生了错误 500: 服务器内部错误500错误是一种常见错误,一是用户错误(客户端问题,少见),另一种是服务器本身的错误(常见)解决办法:1.清除浏览器缓存2.查看错误日志3.查看连接...

    Gilbertat 评论0 收藏0
  • Laravel 5.1 表单提交数据(包含数组)插入数据库错误解决办法

    摘要:当表单中有需要提交数组到数据库,比如要加一些客服的信息,会抛出输入的字段不能为数组的错误,解决办法也很简单。增加多个客服需要用到数组抛出的错误解决办法模型中把需要提交的字段阻止,在控制器中单独用接收并将其序列化,然后再进行保存就可以了。 当表单中有需要提交数组到数据库,比如要加一些客服QQ的信息,Laravel 会抛出输入的字段不能为数组的错误,解决办法也很简单。 增加多个QQ客服需要...

    NusterCache 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<