[英]SSL error : routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
I have a large number of file download links in a txt
file. 我在txt
文件中有大量的文件下载链接。 I am trying to write a python
script to download all the files at once, but I end up with the following error: 我试图写一个python
脚本一次下载所有文件,但我最终得到以下错误:
SSLError: [Errno 1] _ssl.c:499: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
The file is being downloaded via intranet. 该文件正通过Intranet下载。
I tried to download the file via browser and I got a pop up with some certificate
. 我试图通过浏览器下载文件,然后弹出some certificate
。 I tried to google it but didn't find a way to solve this. 我试图谷歌它,但没有找到解决这个问题的方法。
The server certificate is invalid, either because it is signed by an invalid CA (internal CA, self signed,...), doesn't match the server's name or because it is expired. 服务器证书无效,原因是它由无效的CA(内部CA,自签名,...)签名,与服务器名称不匹配或因为它已过期。
Either way, you need to find how to tell to the Python library that you are using that it must not stop at an invalid certificate if you really want to download files from this server. 无论哪种方式,您需要找到如何告诉Python库您正在使用它如果您真的想要从此服务器下载文件,它必须不会停在无效的证书上。
Experienced this myself when using requests
: 在使用requests
时亲自体验过:
This is extremely insecure; 这是非常不安全的; use only as a last resort! 仅作为最后的手段使用! (See rdlowrey's comment.) (见rdlowrey的评论。)
requests.get('https://github.com', verify=True)
Making that verify=False
did the trick for me. 使verify=False
对我来说是个窍门。
Got this issue today and after wandering for several hours just came to know that my server datetime was wrong. 今天遇到这个问题,经过几个小时的漫游后才知道我的服务器日期时间错了。
So first please check your server datetime before going so deep in this issue. 因此,首先请检查您的服务器日期时间,然后再深入研究此问题。
also try doing 也试着去做
>> sudo update-ca-certificates
Got this same error recently in a python app using requests on ubuntu 14.04LTS, that I thought had been running fine (maybe it was and some update occurred). 最近在一个python应用程序中使用ubuntu 14.04LTS上的请求得到了同样的错误,我认为一直运行正常(可能是它并且发生了一些更新)。 Doing the steps below fixed it for me: 执行以下步骤为我修复了它:
pip install --upgrade setuptools
pip install -U requests[security]
Here is a reference: https://stackoverflow.com/a/39580231/996117 这是一个参考: https : //stackoverflow.com/a/39580231/996117
当你的当地时间关闭时(例如在证书验证时间之前)也可能发生,我的错误就是这种情况......
I've experienced the same issue because of certifi
library. 由于certifi
库,我遇到了同样的问题。 Installing a different version helped me as well. 安装不同的版本对我也有帮助。
Normally updating certifi and/or the certifi cacert.pem
file would work. 通常更新certifi和/或certifi cacert.pem
文件将起作用。 I also had to update my version of python. 我还必须更新我的python版本。 Vs. 比。 2.7.5 wasn't working because of how it handles SNI requests. 由于处理SNI请求的方式,2.7.5无法正常工作。
Once you have an up to date pem file you can make your http request using: 获得最新的pem文件后,您可以使用以下命令发出http请求:
requests.get(url, verify='/path/to/cacert.pem')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.