eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.11k stars 2.03k forks source link

I have an issue #2330

Closed ABIRHOSSAIN10 closed 4 months ago

ABIRHOSSAIN10 commented 4 months ago

packages/telebot/async_telebot.py", line 1906, in get_m e result = await asyncio_helper.get_me(self.token) File "/home/mai/.local/lib/python3.10/site- packages/telebot/asyncio_helper.py", line 154, in get_m e return await _process_request(token, method_url) File "/home/mai/.local/lib/python3.10/site- packages/telebot/asyncio_helper.py", line 105, in _proc ess_request raise RequestTimeout("Request timeout. Request: met hod={0} url={1} params={2} files={3} request_timeout={4 }".format(method, url, params, files, request_timeout, current_try)) telebot.asynciohelper.RequestTimeout: Request timeout. Request: method=get url=getMe params=<aiohttp.formdata .FormData object at 0x7f6e5a472560> files=None request timeout=300

coder2020official commented 4 months ago

bad internet, use non_stop=True in your polling function

All-The-Foxes commented 4 months ago

It's not bad internet. Almost all of the time the issue is with Telegram's servers. I run my bots off of a server with 10 gigabit enterprise networking and this happens to me from time to time. The issue is that Async Telebot logs request timeouts as an unhandled exception.

ABIRHOSSAIN10 commented 4 months ago

bad internet, use non_stop=True in your polling function

2024-07-02 06:40:35,530 (asyncio_helper.py:101 MainThre ad) ERROR - TeleBot: "Aiohttp ClientError: ClientConnectorError" Traceback (most recent call last): File "/home/mai10/tg-bot-v2.py", line 888, in asyncio.run(main()) File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/home/mai10/tg-bot-v2.py", line 874, in main await bot.delete_my_commands(scope=None, language_code=None) File "/home/mai10/.local/lib/python3.10/site-packages/telebot/async_telebot.py", line 4547, in delete_my_commands return await asyncio_helper.delete_my_commands(self .token, scope, language_code) File "/home/mai10/.local/lib/python3.10/site- packages/telebot/asyncio_helper.py", line 1264, in dele te_my_commands return await _process_request(token, method_url, pa rams=payload, method='post') File "/home/mai10/.local/lib/python3.10/site- packages/telebot/asyncio_helper.py", line 105, in _proc ess_request raise RequestTimeout("Request timeout. Request: met hod={0} url={1} params={2} files={3} request_timeout={4 }".format(method, url, params, files, request_timeout, current_try)) telebot.asyncio_helper.RequestTimeout: Request timeout. Request: method=post url=deleteMyCommands params=<aioh ttp.formdata.FormData object at 0x7fc626d22350> files=N one request_timeout=300

Same error still it not running. I am trying to host ny bot in pythonanywhere.

When i Don't use AsyncTeleBot it works fine but. When i use this it show me this.even i Try the examples of this github. And still give me the error maybe this module have a problem

Badiboy commented 4 months ago

It show you this error ALWAYS or SOMETIME?

coder2020official commented 4 months ago

Probably asynctelebot won't work on pythonanywhere. I should try it out, but I already had such reports. Not only with this library

ABIRHOSSAIN10 commented 4 months ago

It show you this error ALWAYS or SOMETIME?

Always when i run the bot

ABIRHOSSAIN10 commented 4 months ago

Probably asynctelebot won't work on pythonanywhere. I should try it out, but I already had such reports. Not only with this library

But pyrogram Works on pythonanywhere

Maybe AsyncTeleBot have some problem in there library. I love the module but. After seeing this maybe i have to shift to pyrogram. Because i need to work with asynchronous.

it's took 10 days to build the bot.now i am frustrated. I have to change my full code.

coder2020official commented 4 months ago

I will investigate it at some point

Badiboy commented 4 months ago

But still not doing anything

https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/chat_member_example.py Check examle paying attention at

allowed_updates=util.update_types

coder2020official commented 4 months ago

I don't think we will support pythonanywhere for async. Seems like it blocks some aiohttp requests.