chak_chak
@chak_chak

VKbottle бот на pythonanywhere, ошибка при запуске 'Cannot connect to host api.vk.com:443 ssl:default [Connect call failed ('87.240.137.130', 443)]'?

залил простого бота на бесплатный хост на pythonanywhere, при запуске main.py происходит ошибка:

Traceback (most recent call last):
  File "/home/Chakchak/.local/lib/python3.10/site-packages/vkbottle/framework/bot/bot.py", line 81, in run_polling
    async for event in polling.listen():
  File "/home/Chakchak/.local/lib/python3.10/site-packages/vkbottle/polling/bot_polling.py", line 57, in listen
    server = await self.get_server()
  File "/home/Chakchak/.local/lib/python3.10/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 "/home/Chakchak/.local/lib/python3.10/site-packages/vkbottle/api/api.py", line 67, in request
    response = await self.http_client.request_text(
  File "/home/Chakchak/.local/lib/python3.10/site-packages/vkbottle/http/aiohttp.py", line 73, in request_text
    response = await self.request_raw(url, method, data, **kwargs)
  File "/home/Chakchak/.local/lib/python3.10/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 "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/Chakchak/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.vk.com:443 ssl:default [Connect call failed ('87.240.137.130', 443)]


Я не использовал aiohttp, как я понимаю, её использовала библиотека VKbottle.
В чём ошибка и самое главное как её исправить в моём примере?

код main.py:

from vkbottle import PhotoMessageUploader
from vkbottle.bot import Bot, Message, MessageEvent, rules
from vkbottle_types.events import GroupEventType
import config as cfg
from loguru import logger
from commands import Com

logger.disable('vkbottle')
bot = Bot(token=cfg.token)


@bot.on.private_message()
async def main(message: Message):
    lwr_msg = message.text.lower()
    if lwr_msg == f'{cfg.bot_prefix}':
        await message.answer(cfg.bot_info)
    elif lwr_msg == f'{cfg.bot_prefix} {cfg.com_commands}':
        await message.answer('Прости, но команды доступны только в чате, в лс я пишу только инфу.')
  • Вопрос задан
  • 68 просмотров
Решения вопроса 1
sergey-gornostaev
@sergey-gornostaev Куратор тега AIOHTTP
Седой и строгий
Этот вопрос тут уже много раз задавали и получали ответы. Да и в документации pythonanywhere ответ тоже есть.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы