@feishdanil

Ошибка при создании бота в телеграм ( пайтон)?

from aiogram import Bot, Dispatcher, executor, types
import python_weather

#BOT INIT
bot = Bot(token="5766801524:AAGvBNpti885K30D04-FL7VuzLpfsHTpOTg")
dp = Dispatcher(bot)
client = python_weather.Client(format=python_weather.IMPERIAL, locale="ru-RU")
#echo
@dp.message_handler()
async def echo(message: types.Message):
weather = await client.find(message.text)
celsius = (weather.current.temperature - 32) / 1.8

resp_msg = weather.location_name + "\n"
resp_msg += f"Текущая температура: {celsius}\n"
resp_msg += f"Состояние погоды: {weather.current.sky_text}"

await message.answer(resp_msg)

#run long-p olling
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)

При запуске кода выдаёт ошибку

Traceback (most recent call last):
File "C:\Users\ddggg\PycharmProjects\pythonProject2\main.py", line 7, in
client = python_weather.Client(format=python_weather.IMPERIAL, locale="ru-RU")
TypeError: __init__() got an unexpected keyword argument 'locale'
  • Вопрос задан
  • 120 просмотров
Пригласить эксперта
Ответы на вопрос 1
@igor6130
У конструктора объекта python_weather.Client нет параметра locale.

Уберите токен бота из текста вопроса.
Ответ написан
Ваш ответ на вопрос

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

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