Python SSL HTTS requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51768496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:55:42  来源:igfitidea点击:

SSL HTTS requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443)

pythonsslrequestcertificate

提问by rayashi

I don't know why every httpsrequest returns this erros

我不知道为什么每个https请求都返回这个错误

import requests
requests.get('https://google.com')

requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))

Even in Isomnia give me an error related with certificates

即使在 Isomnia 给我一个与证书相关的错误

enter image description here

在此处输入图片说明

My os is Windows 7 Professional.

我的操作系统是 Windows 7 Professional。

回答by Hagai Wild

requests.get('https://google.com', verify='/path/to/certfile')

or you can skip verifications by doing this:

或者您可以通过执行以下操作跳过验证:

requests.get('https://google.com', verify=False)

You should specify your CA.

您应该指定您的 CA。

回答by user13476428

This fixed it: Python referencing old SSL version

这修复了它:Python 引用旧的 SSL 版本

The openssl versions used to differ for python and the one offered by homebrew

用于 python 的 openssl 版本和 homebrew 提供的版本不同

if brew install python --with-brewd-openssldoesn't work try
brew install openssl brew install python
after uninstalling python

如果 brew install python --with-brewd-openssl不起作用,请
brew install openssl brew install python
在卸载 python 后尝试