возникла ошибка при разработке бота для сообщества VK. при запуске ошибка об ssl сертификате.
ошибка 2024-02-15 16:21:23.283 | INFO | __main__::28 - Creating bot instance...
2024-02-15 16:21:23.295 | INFO | vkbottle.framework.bot.bot:run_polling:79 - Starting polling for >...>
2024-02-15 16:21:23.295 | DEBUG | vkbottle.polling.bot_polling:get_server:49 - Getting polling server...
2024-02-15 16:21:23.296 | DEBUG | vkbottle.api.api:validate_request:112 - API request was validated
Traceback (most recent call last):
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 992, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1111, in _create_connection_transport
await waiter
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 528, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\bot\2.py", line 61, in
asyncio.run(main())
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "c:\bot\2.py", line 57, in main
await bot.run_polling()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\framework\bot\bot.py", line 81, in run_polling
async for event in polling.listen():
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\polling\bot_polling.py", line 57, in listen
server = await self.get_server()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\api\api.py", line 72, in request
response = await self.http_client.request_text(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\http\aiohttp.py", line 73, in request_text
response = await self.request_raw(url, method, data, **kwargs)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 1194, in __aenter__
self._resp = await self._coro
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 578, in _request
conn = await self._connector.connect(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 911, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 1235, in _create_direct_connection
raise last_exc
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 1204, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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:1122)')]
Для продолжения нажмите любую клавишу . . .
# Импорт необходимых модулей
from vkbottle.bot import Bot
from vkbottle.api import API
from vkbottle.user import User
from vkbottle.tools import Keyboard, KeyboardButtonColor
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
from vk_api.utils import get_random_id
from vk_api.bot_longpoll import VkBotMessageEvent
from vkbottle.bot import Message
import aiohttp
import asyncio
import logging
import random
import time
# Токен доступа
token = 'тут обычно токен'
# Логирование перед созданием экземпляра бота
loguru.logger.info("Creating bot instance...")
Михаил Р., Traceback (most recent call last):
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 992, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1111, in _create_connection_transport
await waiter
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 528, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\bot\2.py", line 134, in
asyncio.run(main())
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "c:\bot\2.py", line 130, in main
await bot.run_polling()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\framework\bot\bot.py", line 81, in run_polling
async for event in polling.listen():
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\polling\bot_polling.py", line 57, in listen
server = await self.get_server()
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\api\api.py", line 72, in request
response = await self.http_client.request_text(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\vkbottle\http\aiohttp.py", line 73, in request_text
response = await self.request_raw(url, method, data, **kwargs)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 1194, in __aenter__
self._resp = await self._coro
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\client.py", line 578, in _request
conn = await self._connector.connect(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 911, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 1235, in _create_direct_connection
raise last_exc
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\site-packages\aiohttp\connector.py", line 1204, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "C:\Users\samar\AppData\Local\Programs\Python\Python39\lib\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:1122)')]
Для продолжения нажмите любую клавишу . . .