无法连接到主机discordapp.com:443 ssl:默认[[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:852)]

时间:2020-05-21 03:46:47

标签: windows ssl python-3.6 discord.py

我正在尝试解决当前遇到的这个问题。我真的不理解错误本身,我去过多种形式的研究,试图解决这个问题,但无济于事。

任何反馈和帮助将不胜感激。谢谢!

平台:Windows 10

Python :Python3.6.8

意图:尝试运行不一致的bot应用程序。

结果:我收到此认证错误,该错误不允许程序连接到不和谐状态。

注意:由于某种原因,该bot可以在我的其他Windows 10计算机上运行而没有问题。

错误日志

Traceback (most recent call last):
  File "C:\Users\oiabe\Desktop\AyStar\Oracle(V6).py", line 360, in <module>
    client.run("TOKEN")
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 640, in run
    return future.result()
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 621, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 584, in start
    await self.login(*args, bot=bot)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 442, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 261, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 165, in request
    async with self.__session.request(method, url, **kwargs) as r:
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\client.py", line 483, in _request
    timeout=real_timeout
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "C:\Users\oiabe\AppData\Local\Programs\Python\Python36\lib\site-packages\aiohttp\connector.py", line 941, in _wrap_create_connection
    raise ClientConnectorSSLError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host discordapp.com:443 ssl:default [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)]

1 个答案:

答案 0 :(得分:0)

一种解决方案是取消ssl verify

import asyncio
import sys
import pymysql.cursors
from aiohttp import ClientSession
from aiohttp import TCPConnector





async def postmsg(url,msg):
    async with ClientSession(connector=TCPConnector(verify_ssl=False)) as session:
        # data={"msgtype":"text","text":{"content":msg},"at":{"atMobiles":["17633919216"],"isAtAll":"false"}}
        async with session.post(url,data=json.dumps(msg),headers=headers) as response:
            response = await response.read()
            # print(response)
            return  response