mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 07:24: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
|
.. 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 a new issue