P
P
piki_adm2020-06-22 12:16:28
Python
piki_adm, 2020-06-22 12:16:28

Pythonanywhere and vkbottle, why error?

When running the code:
# -*- coding: utf8 -*-
import random
import sqlite3
from vk_api.longpoll import VkLongPoll
from vkbottle import Bot, Message
from vkbottle.keyboard import Keyboard, Text
from vkbottle import Bot, Message, keyboard_gen
from vkbottle.branch import Branch, ExitBranch
import hashlib
from vkbottle.user import User, Message
from vkbottle import VKError
from vkbottle.utils import logger
import aiohttp
import asyncio
import random
import os
from SimpleQIWI import *
import requests
import json
from datetime import datetime
from vkbottle.framework import BranchCheckupKey
QIWI_TOKEN = '2156b07fe1a8a4db2'


QIWI_ACCOUNT = '+798*****24' bot = Bot("89ac9880************8a19862febba76743bba42526779c1fc0fe612e47322937"

)

API request groups.getById to get group_id [TIME 06-22 08:59:36]Traceback (most recent call last):
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/connector .py", line 936, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/lib/python3.7/asyncio/base_events.py", line 943 , in create_connection
raise exceptions[0]
File "/usr/lib/python3.7/asyncio/base_events.py",line 930, in create_connection
await self.sock_connect(sock, address)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 475, in sock_connect
return await fut
File "/usr/lib/python3.7/asyncio/selector_events.py". py", line 505, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('87.240.190.70', 443)

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

Traceback (most recent call last):
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/http/request.py", line 20, in decorator
response = await func( *args, **kwargs, client=client)
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/http/request.py", line 48, in post
url, params=params or {}, ssl=ssl.SSLContext() , data=data, json=json_,

[VKBottle] Making API request groups.getById to get group_id [TIME 06-22 09:03:23]Traceback (most recent call last):
File "/home/MILORD/.local/ lib/python3.7/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/lib/ python3.7/asyncio/base_events.py", line 943, in create_connection
raise exceptions[0]
File "/usr/lib/python3.7/asyncio/base_events.py", line 930, in create_connection
await self.sock_connect(sock ,address)
File "/usr/lib/python3.7/asyncio/selector_events.py", line 475, in sock_connect
return await fut
File "/usr/lib/python3.7/asyncio/selector_events.py", line 505, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('87.240.190.70', 443)

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

Traceback (most recent call last ):
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/http/request.py", line 20, in decorator
response = await func(*args, **kwargs, client= client)
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/http/request.py", line 48, in post
url, params=params or {}, ssl=ssl.SSLContext(), data=data, json=json_,
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/client.py ", line 1012, in __aenter__
self._resp = await self._coro
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
timeout=real_timeout
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
proto = await self._create_connection(req, traces, timeout)
File "/home/ MILORD/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
req, traces, timeout)
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
raise last_exc
File "/home/MILORD/.local/lib/python3.7/ site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
req=req, client_error=client_error)
File "/home/MILORD/.local/lib/python3.7/site-packages/aiohttp/connector.py" , line 943, 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: [Connect call failed ('87.240.190.70', 443)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/MILORD/mafia_bot.py", line 25, in
bot = Bot("89ac9***************62febba76743bba42526779c1fc0fe612e47322937a202da"
)
File "/home/MILORD/.local/ lib/python3.7/site-packages/vkbottle/framework/bot/bot.py", line 112, in __init__
self.group_id = group_id or self.get_id_by_token(self.__tokens[0])
File "/home/MILORD/ .local/lib/python3.7/site-packages/vkbottle/framework/bot/bot.py", line 213, in get_id_by_token
request("groups.getById", {}, token)
File "/usr/lib/python3 .7/asyncio/base_events.py", line 568, in run_until_complete
return future.result()
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/api/api/util/requester .py",line 28, in request
response = await session.post(url, data=params or {})
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/http/request.py", line 23, in decorator
logger.error(f"Error while requesting:\n{traceback.format_exc()}")
File "/home/MILORD/.local/lib/python3.7/site-packages/vkbottle/utils/tools.py", line 26, in __call__
+ " [TIME {}]".format(t)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question