• <small id='Z6tKi'></small><noframes id='Z6tKi'>

    <i id='Z6tKi'><tr id='Z6tKi'><dt id='Z6tKi'><q id='Z6tKi'><span id='Z6tKi'><b id='Z6tKi'><form id='Z6tKi'><ins id='Z6tKi'></ins><ul id='Z6tKi'></ul><sub id='Z6tKi'></sub></form><legend id='Z6tKi'></legend><bdo id='Z6tKi'><pre id='Z6tKi'><center id='Z6tKi'></center></pre></bdo></b><th id='Z6tKi'></th></span></q></dt></tr></i><div id='Z6tKi'><tfoot id='Z6tKi'></tfoot><dl id='Z6tKi'><fieldset id='Z6tKi'></fieldset></dl></div>
      <bdo id='Z6tKi'></bdo><ul id='Z6tKi'></ul>
  • <legend id='Z6tKi'><style id='Z6tKi'><dir id='Z6tKi'><q id='Z6tKi'></q></dir></style></legend>

      1. <tfoot id='Z6tKi'></tfoot>

        Discord.py 无法获得证书

        时间:2023-09-09
          <legend id='v08or'><style id='v08or'><dir id='v08or'><q id='v08or'></q></dir></style></legend>
        • <i id='v08or'><tr id='v08or'><dt id='v08or'><q id='v08or'><span id='v08or'><b id='v08or'><form id='v08or'><ins id='v08or'></ins><ul id='v08or'></ul><sub id='v08or'></sub></form><legend id='v08or'></legend><bdo id='v08or'><pre id='v08or'><center id='v08or'></center></pre></bdo></b><th id='v08or'></th></span></q></dt></tr></i><div id='v08or'><tfoot id='v08or'></tfoot><dl id='v08or'><fieldset id='v08or'></fieldset></dl></div>

              <tfoot id='v08or'></tfoot>

                <bdo id='v08or'></bdo><ul id='v08or'></ul>

                  <small id='v08or'></small><noframes id='v08or'>

                    <tbody id='v08or'></tbody>
                  本文介绍了Discord.py 无法获得证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我是否必须在我的系统中安装/生成/下载新证书,或者我是否有可能以某种方式禁用 python 中的证书?(ubuntu 18,python 3.7,discord.py 最新)

                  Do I have to install/generate/download new certificate inside my system or is it possible for me somehow to disable certificates inside the python? (ubuntu 18, python 3.7, discord.py latest)

                  [INFO]  [2019.03.05 - 22:58:02]   Initializing Discord...
                  
                  SSL handshake failed on verifying the certificate
                  protocol: <asyncio.sslproto.SSLProtocol object at 0xf4a9f8ec>
                  transport: <_SelectorSocketTransport fd=12 read=polling write=<idle, bufsize=0>>
                  Traceback (most recent call last):
                    File "./build/Lib/asyncio/sslproto.py", line 625, in _on_handshake_complete
                    File "./build/Lib/asyncio/sslproto.py", line 189, in feed_ssldata
                    File "./build/Lib/ssl.py", line 763, in do_handshake
                  ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
                  
                  SSL error in data received
                  protocol: <asyncio.sslproto.SSLProtocol object at 0xf4a9f8ec>
                  transport: <_SelectorSocketTransport closing fd=12 read=idle write=<idle, bufsize=0>>
                  Traceback (most recent call last):
                    File "./build/Lib/asyncio/sslproto.py", line 526, in data_received
                    File "./build/Lib/asyncio/sslproto.py", line 189, in feed_ssldata
                    File "./build/Lib/ssl.py", line 763, in do_handshake
                  ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)
                  
                  [ERROR] [2019.03.05 - 22:58:02]   
                  2019.03.05 - 22:58:02:
                    Top:  file: [sv_custom.py], method: init()
                    Root: file: [connector.py], line 974, cause: in _create_direct_connection [File "./../source/aiohttp.whl/aiohttp/connector.py", line 927, in _wrap_create_connection]
                    aiohttp.client_exceptions.ClientConnectorCertificateError:
                    Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)')]
                  

                  这是通过游戏客户端内部的 python 完成的.如果我从系统的 python (3.6) 中做同样的事情 - 没有错误,连接很好.他们说"这可能是因为游戏客户端没有看到根证书"或类似的东西.

                  This is done from the python that is inside the game client. If I do the same from the system's python (3.6) - no errors, connection is fine. "They say" it could be because the game client does not see "root certificates" or something like that.

                  更新:了解如何检查证书.

                  Update: Found out how to check certificates.

                  (with ssl error)
                  Initializing Discord...
                  DefaultVerifyPaths(cafile=None, capath=None, openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/usr/local/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/usr/local/ssl/certs')
                  
                  
                  (this works fine)
                  igor@Linbox:~/Downloads$ python3.6 -c "import ssl; print(ssl.get_default_verify_paths())"
                  DefaultVerifyPaths(cafile=None, capath='/usr/lib/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/usr/lib/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/usr/lib/ssl/certs')
                  

                  猜猜我的问题是 capath 是空的.

                  Guess that is my problem that capath is empty.

                  推荐答案

                  没想到解决方案看起来很简单:

                  Unexpectedly the solution appeared quite simple:

                  ssl.get_default_verify_paths() 用于带有 ssl 错误的 python 指向:openssl_capath='/usr/local/ssl/certs' 而本机"系统中的 python 显示 openssl_capath='/usr/lib/ssl/certs'.

                  ssl.get_default_verify_paths() for the python with the ssl error was pointing to: openssl_capath='/usr/local/ssl/certs' while the "native" python from the system showed openssl_capath='/usr/lib/ssl/certs'.

                  DefaultVerifyPaths(
                    cafile=None,
                    capath=None,
                    openssl_cafile_env='SSL_CERT_FILE',
                    openssl_cafile='/usr/local/ssl/cert.pem',
                    openssl_capath_env='SSL_CERT_DIR',
                    openssl_capath='/usr/local/ssl/certs'
                  )
                  

                  我已经检查了两个位置:'/usr/local/' - 为空(没有 ssl/certs 文件夹)'/usr/lib/ssl/certs' 有一个指向 '/etc/ssl/certs' 的符号链接所以我做了同样的符号链接:在 '/usr/local/' 里面添加了 '/ssl/' + ln -s '/etc/ssl/certs' 证书

                  I've checked both locations: '/usr/local/' - was empty (it had no ssl/certs folders) '/usr/lib/ssl/certs' had a symlink to '/etc/ssl/certs' So I made the same symlink: inside '/usr/local/' added '/ssl/' + ln -s '/etc/ssl/certs' certs

                  然后我再次检查了 ssl.get_default_verify_paths()

                  DefaultVerifyPaths(
                    cafile=None,
                    capath='/usr/local/ssl/certs',  <-- not empty now
                    openssl_cafile_env='SSL_CERT_FILE',
                    openssl_cafile='/usr/local/ssl/cert.pem',
                    openssl_capath_env='SSL_CERT_DIR',
                    openssl_capath='/usr/local/ssl/certs'
                  )
                  

                  问题消失了.它现在正在工作.

                  The problem disappeared. It is working now.

                  这篇关于Discord.py 无法获得证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py - 如何制作特定于角色的命令? 下一篇:如何按 ID 检索特定消息(尝试 fetch_message(id))

                  相关文章

                  最新文章

                  <tfoot id='hJVZE'></tfoot>

                  <legend id='hJVZE'><style id='hJVZE'><dir id='hJVZE'><q id='hJVZE'></q></dir></style></legend>

                    <small id='hJVZE'></small><noframes id='hJVZE'>

                    <i id='hJVZE'><tr id='hJVZE'><dt id='hJVZE'><q id='hJVZE'><span id='hJVZE'><b id='hJVZE'><form id='hJVZE'><ins id='hJVZE'></ins><ul id='hJVZE'></ul><sub id='hJVZE'></sub></form><legend id='hJVZE'></legend><bdo id='hJVZE'><pre id='hJVZE'><center id='hJVZE'></center></pre></bdo></b><th id='hJVZE'></th></span></q></dt></tr></i><div id='hJVZE'><tfoot id='hJVZE'></tfoot><dl id='hJVZE'><fieldset id='hJVZE'></fieldset></dl></div>

                      <bdo id='hJVZE'></bdo><ul id='hJVZE'></ul>