How can i fix the problem with aiohttp or aiogram?

2.3k Views Asked by At

aiogram.utils.exceptions.NetworkError: Aiohttp client throws error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl: default [Semaphore timeout exceeded] I had this error when i was running the code of my telegram bot. Then, I installed the aiohttp again. And it has gone. But here is another problem. When i run the code of telegram bot, bot is not working. He doesnt answer to my commands, but there is no error in console. No error - but bot doesnt work.
Can someone help me with this problem please? I appreciate any advices and tips. Python-3.8v

Code:

from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import time
from time import sleep
import selenium
from selenium import webdriver
import asyncio
bot = Bot('token')
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def start_message(message):
    await bot.send_message(message.chat.id, 'some text')
1

There are 1 best solutions below

0
On

First, you run python <program> in your terminal with a command like

python test1.py

In terminal you got message

INFO:aiogram.dispatcher.dispatcher:Start polling....

Second, you need to go to Telegram app, to your bot chat. And write comands, like /start.