N
N
nonamefromzp2020-05-04 18:02:54
Python
nonamefromzp, 2020-05-04 18:02:54

Why does a 404 error occur when running a bot on putelegrambotapi?

Hello.
Wrote the most elementary code for the Telegram bot pythontelegrambotapi.

import telebot

TOKEN = '<1275117751:AAFYJ4w3G6rjVZy27JxKCmxkev-ft5LpZVg>'

bot = telebot.TeleBot(TOKEN)

@bot.message_handler(content_types=['text'])

def f1(messages):
  bot.send_message(message.chat.id, message.text)

bot.polling(none_stop=1)


But a 404 error occurred (I didn’t find this anywhere else):
2020-05-04 18:01:04,601 (__init__.py:443 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 404 Not Found. Response body:
[b'{"ok":false,"error_code":404,"description":"Not Found"}']"


I entered the correct token, even changed it several times. Help, who knows what's wrong. I will be very grateful.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-05-04
@nonamefromzp

1) Remove the angle brackets from the token - "<" and ">"
2) In the "def f1(messages):" line, replace messages with message

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question