[Python] Is there a risk that “get_input_entity()” of Telethon will also exceed telegram API...

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    If we request the telegram API through get_entity('username') function of telethon too many times, we will received a “punishment”:


    FloodWaitError: A wait of xxxxx seconds is required (caused by ResolveUsernameRequest).
    ​

    According to the telethon documents, to avoid duplicated requests, we could use get_input_entity() for the first time, then we could use other function like get_entity('username'), benefiting from the saved information in cache.

    My questions are below:


    1. if we use get_input_entity() too many times, do we get the same "FloodWaitError" like we using get_entity()? If so, what is an appropriate request interval for get_input_entity()?


    2. what is an appropriate way to input many entities all at once? Currently, I just use a loop to get_input_entity() some usernames from a list one by one.


    3. Also, after I get_input_entity() of some usernames and saved them in the cache. If I disconnect my client, do I need to get_input_entity() of them next time?

    Continue reading...

Compartilhe esta Página