有一个电报机器人已经工作了 3 个月,大约 2 周前开始出现定期错误,无法连接到电报服务器,尽管那里有互联网,有关于如何解决此问题的想法吗?
python --version
Python 3.11.5
python -m pip show aiogram
Name: aiogram
Version: 3.3.0
Summary: Modern and fully asynchronous framework for Telegram Bot API
Home-page:
Author:
Author-email: Alex Root Junior <[email protected]>
License:
Location: C:\Users\adelt\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires: aiofiles, aiohttp, certifi, magic-filter, pydantic, typing-extensions
Required-by:
python -m pip show aiohttp
Name: aiohttp
Version: 3.9.1
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author:
Author-email:
License: Apache 2
Location: C:\Users\adelt\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires: aiosignal, attrs, frozenlist, multidict, yarl
Required-by: aiogram
该机器人在 Windows 11 的 PC 上启动,PC 上的时间是正确的错误示例:
Failed to fetch updates - TelegramNetworkError: HTTP Client says - ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [getaddrinfo failed]
Sleep for 1.000000 seconds and try again... (tryings = 0, bot id = *******))
Failed to fetch updates - TelegramNetworkError: HTTP Client says - ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [getaddrinfo failed]
Sleep for 1.264188 seconds and try again... (tryings = 1, bot id = *******))
Failed to fetch updates - TelegramNetworkError: HTTP Client says - ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [getaddrinfo failed]
Sleep for 1.678613 seconds and try again... (tryings = 2, bot id = *******))
Failed to fetch updates - TelegramNetworkError: HTTP Client says - ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [getaddrinfo failed]
Sleep for 2.187897 seconds and try again... (tryings = 3, bot id = *******)