from pyowm import OWM
import telebot
from pyowm.utils.config import get_default_config
config_dict = get_default_config()
config_dict['language'] = 'ru'
owm = OWM('3ce58b3d6bef6c62e493bce064940648', config_dict)
bot = telebot.TeleBot("1530901526:AAHIu2HLtQZaOsj16Ara4ux9zRX1rRoaMrg", parse_mode=None)
@bot.message_handler(content_types=['text'])
def send_echo(message):
mgr = owm.weather_manager()
observation = mgr.weather_at_place(message.text)
w = observation.weather
temp = w.temperature('celsius')['temp']
speed = w.wind()['speed']
answer = "В городе " + message.text + " сейчас " + w.detailed_status + "\n"
answer += "Температура сейчас в районе: " + str(temp) + " ℃" + "\n"
answer += "Ветер со скоростью: " + str(speed) + " м/с" + "\n"
if temp < 0:
answer += "L"
elif temp < 10:
answer += "E"
elif temp < 20:
answer += "!"
elif temp < 25:
answer += "W"
elif temp < 40:
answer += "I"
if speed < 0:
answer += "Q"
elif speed < 5:
answer += "R"
elif speed < 10:
answer += "P"
elif speed < 15:
answer += "O"
bot.send_message(message, answer)
bot.polling( none_stop= True)
Ошибка: (__init__.py:515 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: chat not found"