@RDewize

Проблемы с каким-то сертификатом VKBottle, что делать?

Запуская даже код с документации, выскакивает ошибка такого рода:

Никак не могу решить, везде пишут про VPN, не помогает. Зашёл с чистого пк не помогает.

INFO:vkbottle:logging is used as the default logger, but we recommend using loguru. It may also become a required dependency in future releases.
INFO:vkbottle:Loop will be ran forever
DEBUG:asyncio:Using proactor: IocpProactor
INFO:vkbottle:Starting polling for >...>
DEBUG:vkbottle:Getting polling server...
DEBUG:vkbottle:API request was validated
ERROR:asyncio:Task exception was never retrieved
future: exception=ClientConnectorCertificateError(ConnectionKey(host='api.vk.com', port=443, is_ssl=True, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None), SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000)'))>
Traceback (most recent call last):
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 992, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\asyncio\base_events.py", line 1147, in create_connection
transport, protocol = await self._create_connection_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\asyncio\base_events.py", line 1180, in _create_connection_transport
await waiter
File "C:\Program Files\Python312\Lib\asyncio\sslproto.py", line 578, in _on_handshake_complete
raise handshake_exc
File "C:\Program Files\Python312\Lib\asyncio\sslproto.py", line 560, in _do_handshake
self._sslobj.do_handshake()
File "C:\Program Files\Python312\Lib\ssl.py", line 917, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\framework\bot\bot.py", line 81, in run_polling
async for event in polling.listen():
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\polling\bot_polling.py", line 57, in listen
server = await self.get_server()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\polling\bot_polling.py", line 51, in get_server
self.group_id = (await self.api.request("groups.getById", {}))["response"][0]["id"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\api\api.py", line 72, in request
response = await self.http_client.request_text(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\http\aiohttp.py", line 73, in request_text
response = await self.request_raw(url, method, data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\vkbottle\http\aiohttp.py", line 50, in request_raw
async with self.session.request(url=url, method=method, data=data, **kwargs) as response:
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\client.py", line 1194, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\client.py", line 578, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 911, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 1235, in _create_direct_connection
raise last_exc
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 1204, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\RDewize\AppData\Roaming\Python\Python312\site-packages\aiohttp\connector.py", line 994, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.vk.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000)')]
  • Вопрос задан
  • 225 просмотров
Пригласить эксперта
Ответы на вопрос 1
@ivan_kniga
Библиотека обновляла сертификаты и такая проблема теперь у многих пользователей, решение не самое лучше, но рабочее:
from vkbottle.http import SingleAiohttpClient
from vkbottle.bot import Bot
from vkbottle.api import API
from aiohttp import TCPConnector 

bot = Bot(
    api=API(
        token="vk.....................",
        http_client=SingleAiohttpClient(
            connector=TCPConnector(verify_ssl=False)
        )
    )
)


Также не забудь установить последнюю версию AiohttpClient или поставить версию vkbottle с dev ветки (смотреть на их гитхабе ее название)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы