简体   繁体   English

使用 get() 时如何修复 SSL 证书错误?

[英]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.

相关问题 我该如何解决 <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)> 在Python中? - How do I fix <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)> in Python? APNS,当程序在 Mac 上运行时,如何修复树莓派上的“无法获取本地颁发者证书”错误? - APNS, how do I fix “unable to get local issuer certificate” error on raspberry Pi when program works on Mac? 如何使用 urllib 修复 SSL 证书错误? - How to fix a SSL Certificate error with urllib? 为什么我在使用 API 时不断收到 SSL: CERTIFICATE_VERIFY_FAILED] 错误? - Why do I keep getting SSL: CERTIFICATE_VERIFY_FAILED] error when using API's? 如何解决“SSL:CERTIFICATE_VERIFY_FAILED”错误? - How do I get around the “SSL: CERTIFICATE_VERIFY_FAILED” error? 当ssl设置看起来正常时,为什么在Python中得到[SSL:CERTIFICATE_VERIFY_FAILED]? - Why do I get [SSL: CERTIFICATE_VERIFY_FAILED] in Python when ssl setup looks OK? 如何验证 python 中的 SSL 证书? - How do I verify an SSL certificate in python? 如何在 Python 中更新 SSL 证书? - How do I update an SSL certificate in Python? 使用渲染时如何修复 TemplateDoesNotExist 错误? - How do I fix TemplateDoesNotExist error when using render? 如何解决[SSL: CERTIFICATE_VERIFY_FAILED] 在不绕过SSL 验证的情况下使用urllib 时出错 - How to Solve [SSL: CERTIFICATE_VERIFY_FAILED] Error when Using urllib without bypassing SSL verification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM