Slow internet connection on Replit

Question: Hi there! I faced a small problem. My app using Telegram API suddenly stopped working but it worked before. I found the reason of it. When I try to connect using pyrogram or telethon, I can’t do it. pyrogram shows me error messages about empty packets (this is how I found the reason) and telethon just doesn’t work but without any errors.

There is the easy script which doesn’t work:

from telethon import functions
from telethon.sync import TelegramClient


with TelegramClient('client', api_id, api_hash) as client:
    client(functions.account.UpdateProfileRequest(about=some_string_declared_before))  
Traceback (most recent call last):
  File "/home/runner/some-repo/test.py", line 10, in <module>
    with TelegramClient('client', api_id, api_hash) as client:
  File "/home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/helpers.py", line 219, in _sync_enter
    return loop.run_until_complete(self.__aenter__())
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 1863, in _run_once
    event_list = self._selector.select(timeout)
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/selectors.py", line 469, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
Task was destroyed but it is pending!
task: <Task pending name='Task-5' coro=<MTProtoSender._send_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/mtprotosender.py:462> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-6' coro=<MTProtoSender._recv_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/mtprotosender.py:505> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Connection._send_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/connection/connection.py:311> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-4' coro=<Connection._recv_loop() running at /home/runner/some-repo/venv/lib/python3.10/site-packages/telethon/network/connection/connection.py:329> wait_for=<Future pending cb=[Task.task_wakeup()]>

There is nothing in the console and it doesn’t change my status in Telegram account, so I stopped the script by Ctrl+C and it shows me this traceback. It speaks of some problems with internet on Replit. How can I fix it?

1 Like

A small note: I also tried to run script on my PC and it works unlike repo on Replit.

1 Like

About the error on pyrogram — I found this issue, but there are no solutions, so this forum is the only way to help me.

The error is because you used CTRL+C…

What do you mean? It’s just the way to stop script. The reason why I went to Repl.it is the stopped script which works before. And I decided to examine what happened, because it stopped. I have Hacker sub and I switched Always On. Where is the problem?

1 Like

hey, the replit api is blacklisted on some APIs I think, so I don’t think it’s the best if you depend on APIs

Try doing kill 1 in the shell, however, and see if that does something.

I’m confused. How is this related to the Replit API?

Didn’t help, unfortunately.

oops I meant replit IP