对 Telegram API 的请求未成功。服务器返回 HTTP 403 Forbidden

A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden

我在 python.

的 telebot 包上写了电报机器人

从 03/01/2021 开始没有问题。该机器人的主要任务是从用户发送的文档中解析信息。它还处理一些命令。所有其他类型的数据从用户转发给开发者。

2022 年 1 月 17 日,日志中出现了 5 个错误条目:

A request to the Telegram API was unsuccessful. Error code: 502 Description: Bad Gateway

大约一个小时后,用户的每个请求都在日志中返回错误:

A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body:\n[b'<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n<hr><center>nginx/1.18.0</center>\r\n</body>\r\n</html>\r\n']"

我发现当 bot 尝试使用 download_file() 方法从用户下载已发送的文档时出现 403 错误。我的代码中断的部分:

def handling_documents(message):
    def save_file():
        downloaded_file = bot.download_file(bot.get_file(message.document.file_id).file_path)
        filename = message.document.file_name

该机器人在 CentOS 上运行。我尝试了其他工作场所,问题是实际的。 https://api.telegram.org/file/bot_token/file_path 中的问题。机器人成功处理的任何其他类型的消息(照片、贴纸、文本等)。

无法在 google 上找到好的解决方案。每天大约有 100 名用户使用该机器人。我等不及了,因为它写在 .

我也找到了撤销 API 令牌的解决方案 https://github.com/eternnoir/pyTelegramBotAPI/issues/581 但是之后 403 错误的问题仍然存在。有什么问题吗?

我使用 PyTelegramBotAPI 4.3.1 版本,Linux Mint 20.2,PyCharm。 我没有找到俄罗斯社区 Whosebug 的帮助。

P.S。抱歉我的英语写不清楚

这似乎是某种电报 api 错误。问题自行解决。 Bot 在停机 2 天后恢复。