Indentaion Error
Я хочу создать бота в Telegram, но не могу по сколько присутствует такая ошибка.
@dp.message_handler(commands=["start"])
^
IndentationError: expected an indented block after 'with' statement on line 10
А вот и сам код.
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import python_weather
bot = Bot(token="5946210024:AAGkNfgBnFcDBNQLZIEoKVtlZCikxe7VNis")
dp = Dispatcher(bot)
async with python_weather.Client(format=python_weather.IMPERIAL)as client:
@dp.message_handler(commands=["start"])
async def process_start_command(message):
weather = await client.get(message.text)
celsius = (weather.current.temperature - 32) * 5 / 9
resp_msg = weather.location_name + "\n"
resp_msg += f"Текущая температура:{celsius}\n"
await message.answer(message.text)
@dp.message_handler()
async def echo_message(msg: types.Message):
await bot.send_message(msg.from_user.id, msg.text)
if __name__ == '__main__':
executor.start_polling(dp)
Источник: Stack Overflow на русском