Update handling errors example
Use asyncio.sleep instead of time.sleep
This commit is contained in:
parent
e9e6c30d05
commit
8515ef1746
@ -96,10 +96,12 @@ The value is stored in the ``x`` attribute of the exception object:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import time
|
import asyncio
|
||||||
from pyrogram.errors import FloodWait
|
from pyrogram.errors import FloodWait
|
||||||
|
|
||||||
try:
|
...
|
||||||
... # Your code
|
try:
|
||||||
except FloodWait as e:
|
... # Your code
|
||||||
time.sleep(e.x) # Wait "x" seconds before continuing
|
except FloodWait as e:
|
||||||
|
await asyncio.sleep(e.x) # Wait "x" seconds before continuing
|
||||||
|
...
|
Loading…
Reference in New Issue
Block a user