[英]How do I fix a SSL Certificate error when using a get()?
I am running a requests line like the following:我正在运行如下请求行:
reqs = requests.get('http://test.com')
I am being returned the following error:我收到以下错误:
SSLError: HTTPSConnectionPool(host='test.com', port=443): Max retries exceeded with url: /?q=test.org (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
I have tried the following:我尝试了以下方法:
pip install python-certifi-win32
pip install --upgrade certifi
And neither seem to work.而且似乎都不起作用。 Does anyone know how to fix this?
有谁知道如何解决这一问题?
Ahh, recreating here as the syntax in the comments is always hard to read.啊,在这里重新创建注释中的语法总是很难阅读。
I've found for the requests library, when testing on the local machine I need to put this at top of file:我找到了 requests 库,在本地机器上测试时,我需要把它放在文件的顶部:
import os # Obviously!
os.environ['NO_PROXY'] = '127.0.0.1'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.