How to avoid Flood Waits?#
Slow things down and make less requests. Moreover, exact limits are unknown and can change anytime based on normal usages.
When a flood wait happens the server will tell you how much time to wait before continuing. The following shows how to catch the exception in your code and wait the required seconds.
import asyncio
from pyrogram.errors import FloodWait
...
try:
... # Your code
except FloodWait as e:
await asyncio.sleep(e.value) # Wait "value" seconds before continuing
...
More info about error handling can be found here.