[Python] Why I am getting each time "Flood Wait Error"?

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

  1. Stack

    Stack Membro Participativo

    from telethon.sync import TelegramClient
    import asyncio
    import time


    async def main_send(client):
    time.sleep(1)
    for url_h in ['@user1','@user2'.....,'@user50']:
    bot_entity = await client.get_input_entity(peer=url_h)
    await client.send_message(entity=bot_entity, message='message1')
    time.sleep(10)
    time.sleep(7)


    async def main_get(client):
    lst = []
    for url_v in for url_h in ['@user1','@user2'.....,'@user50']:
    bot_entity = await client.get_input_entity(url_v)
    async for message in client.iter_messages(bot_entity, wait_time=10, limit=60):
    lst.append(message)

    api_id='...'
    api_hash='...'
    client = TelegramClient('for_otzv', api_id, api_hash)
    with client:
    client.loop.run_until_complete(main_send(client))
    client.loop.run_until_complete(main_get(client))



    I have a very simple application for sending bulk messages. The documentation says "telegram api has a limit of 20 request per minute". But i use sleep function, and it should be OK.

    What can be wrong? I didnt terminate sessions. The errors:


    telethon.errors.rpcerrorlist.SessionRevokedError: The authorization has been invalidated, because of the user terminating all sessions (caused by GetHistoryRequest)
    ​

    Continue reading...

Compartilhe esta Página