可以使用http请求for portainer.io [ssl:cetide_verify_failed]

发布于 2025-02-07 13:28:24 字数 626 浏览 3 评论 0 原文

因此,我的任务是编写一个可以与portainer.io的API互动的程序。问题是,我会发现错误:

最大检索超过了url: /api /auth(由sslerror引起(sslcertverificationerror(1,'[ssl:certift _verify_failed]]证书验证验证失败:无法获得本地发行者证书(_SSSL.C:1091)')

最大检索超过了url: /api /auth(由sslerror引起(sslcertverificationerror(1,'[ssl: certif 喜欢:

import requests

URL = "https://localhost:9443"

data_auth = {
  "password": "password",
  "username": "username"
}

url_auth = URL + "/api/auth"

auth_response = requests.post(url_auth, data_auth)

print(auth_response)

有人知道如何解决此错误吗?我应该创建自己的SSL证书吗?我在这里迷路了。

So I was tasked with writing a program that would interact with portainer.io's API. The problem is though, that I get the error :

Max retries exceeded with url: /api/auth (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)')))

An example would look like:

import requests

URL = "https://localhost:9443"

data_auth = {
  "password": "password",
  "username": "username"
}

url_auth = URL + "/api/auth"

auth_response = requests.post(url_auth, data_auth)

print(auth_response)

Does anyone know how to fix this error ? Should I create my own SSL certificate ? I am lost here.

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

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

发布评论

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

评论(1

风铃鹿 2025-02-14 13:28:24

请求,如果将验证设置为false,也可以忽略验证SSL证书。

requests.get('https://localhost:9443', verify=False)
<Response [200]>

现在了解这是 bad ,您永远不要忽略您的SSL证书。但是对于本地发展而言,这就是如何超越它。

requests can also ignore verifying the SSL certificate if you set verify to False.

requests.get('https://localhost:9443', verify=False)
<Response [200]>

Now understand this is bad, you should never ignore your SSL certs. But for development locally this is how to get past it.

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