Не пишет градусы и состояние погоды
Не понимаю в чём проблема, я новичок и начал изучать питон 2 дня назад. Делал всё по видео, помогите, пожалуйста. Пока писал код вообще перестал работать, теперь бот не отвечает. Код таков:
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import python_weather
bot = Bot(token="Мой токен")
dp = Dispatcher(bot)
@dp.message_handler(commands=["start"])
async def process_start_command(message):
async with python_weather.Client(format=python_weather.IMPERIAL, locale="ru-RU") as client:
weather = await client.find("Краснодар")
celsius = (weather.current.temperature - 32) * 5 / 9
resp_msg = weather.location_name + "\n"
resp_msg += f"Текущая температура:{celsius}\n"
resp_msg += f"Состояние погоды: {weather.current.sky_text}"
await message.answer(resp_msg)
#await client.close()
@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)