V
V
Vyacheslav Grachunov2019-10-30 01:43:10
Python
Vyacheslav Grachunov, 2019-10-30 01:43:10

Why hangs on channel_entity?

I am using the Telethon library
Code snippet:

@client.on(events.NewMessage(chats=(channel)))
        async def normal_handler(event):
          print(event.message)
          print(event.message.id)
          print(event.message.to_id.channel_id)

          for s_client in sessions:
            s = await s_client.get_me()
            print(s)
            print(event.message.to_id)
            channel_entity = await s_client.get_entity(event.message.to_id)
            print(channel_entity)

An already started session is stored in s_client, or rather, several sessions inside the sessions list
client.get_me() works quietly, but hangs on client.get_entity. Why? What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rusbelarus, 2021-02-08
@Rusbelarus

Who managed to decide? My script goes into eternal waiting for a response, one of the sessions is sure to be weird in a day, and you can’t implement a forced interrupt, it doesn’t throw exceptions, subprocces tried timeouts, etc. to no purpose. The script is spinning on the server, getting a hangup message is also not realistic, only if you constantly screen to the server and reboot the system :(. phones installed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question