question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request for not found token : `bot_token`

See original GitHub issue

First, I should thank you for your great app. In polling mode on my local machine the module works like charm. However when I use the web hook mode, sometimes I get the

Request for not found token : bot_token

error and no response is given by the bot. I didn’t setup the cert file in my settings.py . I am using nginx with combination of gunicorn to serve my web app. The server os is ubuntu 16.04. Below is the settings I’ve used:

DJANGO_TELEGRAMBOT = {
    'MODE' : 'WEBHOOK', #(Optional [str]) # The default value is WEBHOOK,
                        # otherwise you may use 'POLLING'
                        # NB: if use polling you must provide to run
                        # a management command that starts a worker
    'WEBHOOK_SITE' : 'https://www.shipup.ir',
    'WEBHOOK_PREFIX' : '/telegram-bot/', # (Optional[str]) # If this value is specified,
                                  # a prefix is added to webhook url
   # 'WEBHOOK_CERTIFICATE' : '', # If your site use self-signed
                         #certificate, must be set with location of your public key
                         #certificate.(More info at https://core.telegram.org/bots/self-signed )
    'BOTS' : [
        {
           'TOKEN': 'bot_token', #Your bot token.
        },
    ],
}

The thing that intrigues is the point that sometimes my bot works. Any advice to solve the issue is appreciated.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
marqueewinqcommented, Oct 13, 2017

@JungDev @mrabedini Ok, that’s what i found

This error is mainly caused by TelegramError (Flood control), which is caused by rapid setWebhook queries. Perhaps, if bot.getWebhookInfo().url != hookurl: <set webhook> check will help.

4reactions
mrabedinicommented, Jul 6, 2017

I found the problem. In gunicorn the number of workers were set to 3. Just one of them could have bot_tokens and two of them didn’t have the tokens. When I set the number of workers to 1, everything is ok. Now the question is what should I do to get it to work with number of workers 3 in gunicorn.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Discord.py - Bot token failing - Stack Overflow
The problem is you haven't enabled some permissions in the developer portal, not because of the TOKEN. First you go to the dev...
Read more >
How to Get a Discord Bot Token - WriteBots
If you already have a bot created, click it in the list. If you don't have any discord bots, click the “New Application”...
Read more >
Telegram Bot Token | GitGuardian documentation
Summary: Telegram is a messaging app. This detectors aims at catching tokens used by bots to authenticate requests. IPs allowlist: This feature is...
Read more >
Why can't I copy my bot's token? - Developers - Discord
TL;DR If you are not seeing the Copy button located in your bot settings to copy your bot's token, this means the token...
Read more >
Create and regenerate API tokens - Slack
Scroll to find the workspace and user that you'd like to re-issue a token for. Click Re-issue token. (You may see Request token...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found