mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Update docs
This commit is contained in:
parent
7439e1e8f2
commit
197539809a
@ -43,17 +43,18 @@ Examples
|
||||
except UnknownError:
|
||||
pass
|
||||
|
||||
Exceptions may also contain some informative values which can be useful.
|
||||
e.g. :obj:`FloodWait <pyrogram.api.errors.exceptions.flood_420.FloodWait>` holds the amount of seconds you have to wait before you
|
||||
can try again. The value is always stored in the ``x`` field of the returned exception object:
|
||||
Exception objects may also contain some informative values.
|
||||
E.g.: :obj:`FloodWait <pyrogram.api.errors.exceptions.flood_420.FloodWait>` holds the amount of seconds you have to wait
|
||||
before you can try again. The value is always stored in the ``x`` field of the returned exception object:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
from pyrogram.api.errors import FloodWait
|
||||
|
||||
try:
|
||||
...
|
||||
except FloodWait as e:
|
||||
print(e.x)
|
||||
time.sleep(e.x)
|
||||
|
||||
**TODO: Better explanation on how to deal with exceptions**
|
@ -21,8 +21,9 @@ Configuration
|
||||
|
||||
There are two ways to configure a Pyrogram application project, and you can choose the one that fits better for you:
|
||||
|
||||
- Create a new ``config.ini`` file at the root of your working directory,
|
||||
copy-paste the following and replace the **api_id** and **api_hash** values with `your own <#api-keys>`_:
|
||||
- Create a new ``config.ini`` file at the root of your working directory, copy-paste the following and replace the
|
||||
**api_id** and **api_hash** values with `your own <#api-keys>`_. This is the preferred method because allows you
|
||||
to keep your credentials out of your code without having to deal with how to load them:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
@ -30,7 +31,8 @@ There are two ways to configure a Pyrogram application project, and you can choo
|
||||
api_id = 12345
|
||||
api_hash = 0123456789abcdef0123456789abcdef
|
||||
|
||||
- Alternatively, you can pass your API key to Pyrogram by simply using the *api_key* parameter of the Client class:
|
||||
- Alternatively, you can pass your API key to Pyrogram by simply using the *api_key* parameter of the Client class.
|
||||
This way you can have full control on how to store and load your credentials:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user