Bug: polling() not connecting to Telegram API (requests timeout) #2188
shorecodeorg
started this conversation in
General
Replies: 1 comment
-
The url is NOT like: So its like: With telebot:import telebot With requests:import requests |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please answer these questions before submitting your issue. Thanks!
4.16.1
Linux Mint
3.10.12
Issue: When I try to use polling() I get a timeout error from requests library.
Steps I took to isolate the issue:
Test outside Python
I tested the API endpoint using a curl tool and I was successful in getting responses from the getme and getupdates endpoint when using the same URL that pyTelegramBotAPI uses.
Test requests
I tested the Python requests library with a different URL and received a quick 200 response.
Test requests with bot URL
I tested the Python requests library with the same URL that pyTelegramBotAPI uses and there was no response. Implemented a 10 second timeout throws the timeout error as expected.
Test requests with Telegram API
I tested the Python request library using the get method to connect to 'https://api.telegram.org/', again no response.
It would appear that the requests library cannot connect to the Telegram bot API.
When enabling debug I get the following:
2024-02-26 10:16:17,005 (apihelper.py:87 MainThread) DEBUG - TeleBot: "Request: method=get url=https://api.telegram.org/botXXXXXXX:{TOKEN}/getMe params=None files=None"
XXXXXXX being the first section before the colon of my api token, edited for privacy.
Beta Was this translation helpful? Give feedback.
All reactions