“证书验证失败:证书已过期 (_ssl.c:****)"尝试将我的机器人连接到不和谐 [英] "Certificate verify failed: certificate has expired (_ssl.c:****)" When attempting to connect my bot to discord

查看:49
本文介绍了“证书验证失败:证书已过期 (_ssl.c:****)"尝试将我的机器人连接到不和谐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 python 制作一个不和谐的机器人.当我尝试运行它以将我的客户端连接到不和谐时,我收到此错误:

I'm making a discord bot using python. When I try to run it to connect my client to discord I get this error:

引发 ClientConnectorCertificateError(aiohttp.client_exceptions.ClientConnectorCertificateError:不能连接到主机 discord.com:443 ssl:True [SSLCertVerificationError:(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:证书已过期 (_ssl.c:****)')]

raise ClientConnectorCertificateError( aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:****)')]

每次我尝试运行它时都会发生.

Happens every time I try to run it.

我看到了一个合理的解决方法是:

I saw a plausible fix for this which was:

  • 使用 Internet Explorer 访问 discord.com(以管理员身份运行)
  • 点击右上角的锁
  • 点击查看证书
  • 安装一个

但是,当我尝试它然后再次尝试运行我的机器人时,我仍然遇到同样的错误.

However, when I tried it and then tried to run my bot again I still got the same error.

不知道这是否相关,但在 Traceback 部分的错误消息的开头,它说引发错误的第一个调用位于我的机器人代码的最后一行,即 client.run(TOKEN).

Dont know if this is relevant but at the start of the error message in the Traceback section it says the first call that started the error is in the last line of my bot's code which is client.run(TOKEN).

我在 Windows 10 上使用 Python 3.8.

I'm using Python 3.8 on Windows 10.

推荐答案

TL;DR 您的证书已过期,您需要从网站下载并安装新证书并将其安装到您的本地计算机上操作系统.

TL;DR Your certificate has expired, and you need to download and install the new one to your local machine by downloading it from the website and installing it into your OS.

此解决方案使用 Google Chrome 和 Windows 10 执行.

This solution is performed using Google Chrome and Windows 10.

  1. 转到您尝试请求的网站
  2. 点击 URL 输入字段左侧的锁定图标
  3. 如果显示证书(有效),则表明您正在开展业务.点击那个
  4. 在结果窗口中,点击详细信息标签
  5. 点击复制到文件...
  6. 在证书导出向导中,选择 Cryptographic Message Syntax Standard (.P7B)
  7. 选中它下面的框,如果可能,请在证书路径中包含所有证书
  8. 单击下一步,单击浏览并选择一个文件夹,为文件创建一个名称并单击保存
  9. 下一步,完成
  10. 打开刚刚导出的文件.如果您使用的是 Windows,它将打开证书管理器
  11. 深入文件夹以查找实际证书
  12. 逐一双击每个证书,然后为当前用户选择安装证书,然后自动选择它的去向

安装验证 HTTPS 请求所需的所有证书后,您的脚本不应再遇到证书过期错误,直到新证书过期.

Once you install all the certificates required to validate the HTTPS request, your script shouldn't encounter the certificate expired error anymore, until the new certs expire.

您还可以在 certmgr 中检查每个证书的到期时间.

You can also check when each cert expires in certmgr.

这篇关于“证书验证失败:证书已过期 (_ssl.c:****)"尝试将我的机器人连接到不和谐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆