INNER CODE UNIT · Python

polling

TechXueXi/TechXueXi · SourcePackages/telegramListener.py:108

def polling():
    try:
        bot.polling(non_stop=True, timeout=120)
    except Exception as e:
        print("telegtram listener reconnecting...")
    finally: #资源回收
        gc.collect() #资源回收
        polling()


if __name__ == '__main__':
    if os.getenv('Nohead') == "True" and pushmode == "5":
        proxy = cfg_get("addition.telegram.proxy")
        if proxy and cfg_get("addition.telegram.use_proxy", False):
            apihelper.proxy = {'http': proxy, 'https': proxy}
            apihelper.CONNECT_TIMEOUT = 120
            try:
                info = bot.get_me()  # 尝试通过代理获取信息

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…