mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Update handling errors example
Use asyncio.sleep instead of time.sleep
This commit is contained in:
parent
e9e6c30d05
commit
8515ef1746
1 changed files with 7 additions and 5 deletions
|
|
@ -96,10 +96,12 @@ The value is stored in the ``x`` attribute of the exception object:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import asyncio
|
||||
from pyrogram.errors import FloodWait
|
||||
|
||||
try:
|
||||
... # Your code
|
||||
except FloodWait as e:
|
||||
time.sleep(e.x) # Wait "x" seconds before continuing
|
||||
...
|
||||
try:
|
||||
... # Your code
|
||||
except FloodWait as e:
|
||||
await asyncio.sleep(e.x) # Wait "x" seconds before continuing
|
||||
...
|
||||
Loading…
Reference in a new issue