JungDev / django-telegrambot

Simple app for Telegram bot in Django
BSD 3-Clause "New" or "Revised" License
237 stars 88 forks source link

apps Error : RetryAfter() #20

Open newton21890 opened 6 years ago

newton21890 commented 6 years ago

I'm trying to use django-telegram bot but during the running phase I have this error frequently:

ERROR 2018-05-29 16:28:47,375 apps Error : RetryAfter() after this message the system doesn't work, this is the message during the chat:

WARNING 2018-05-29 16:28:55,619 views Request for not found token : XXXXXXXXXXXXXX
[29/May/2018 16:28:55]"POST /prefix/XXXXXXXXXXXXXXXX/ HTTP/1.1" 200 2

The result is that I don't receive any message in telegram.

I think the problem is in the rapidly sequence of instruction in apps.py file during the setWebhook phase . A possible solution that I finded is this:

setted = bot.setWebhook(hookurl, certificate=certificate, timeout=timeout, max_connections=max_connections, allowed_updates=allowed_updates)
time.sleep(5)
webhook_info = bot.getWebhookInfo()

I added to time.sleep function and now the system seems to work.

jafrancov commented 5 years ago

Have you find any other solution? When I add that line, sends me a 404 page.

jafrancov commented 5 years ago

@newton21890 Best approach to solve it PR #10