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

发布于 2025-02-06 22:26:15 字数 645 浏览 1 评论 0原文

我正在运行请求行,如以下内容:

reqs = requests.get('http://test.com')

我正在返回以下错误:

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)')))

我尝试了以下内容:

pip install python-certifi-win32
pip install --upgrade certifi

而且似乎都没有用。有人知道如何解决这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒废 2025-02-13 22:26:15

啊,在这里以评论中的语法重新创建总是很难阅读。

我已经找到了请求库,在本地计算机上进行测试时,我需要将其放在文件的顶部:

import os  # Obviously!

os.environ['NO_PROXY'] = '127.0.0.1'

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:

import os  # Obviously!

os.environ['NO_PROXY'] = '127.0.0.1'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文