Update docs

This commit is contained in:
Dan 2018-02-22 13:07:41 +01:00
parent 7439e1e8f2
commit 197539809a
2 changed files with 10 additions and 7 deletions

View File

@ -43,17 +43,18 @@ Examples
except UnknownError: except UnknownError:
pass pass
Exceptions may also contain some informative values which can be useful. 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 E.g.: :obj:`FloodWait <pyrogram.api.errors.exceptions.flood_420.FloodWait>` holds the amount of seconds you have to wait
can try again. The value is always stored in the ``x`` field of the returned exception object: before you can try again. The value is always stored in the ``x`` field of the returned exception object:
.. code-block:: python .. code-block:: python
import time
from pyrogram.api.errors import FloodWait from pyrogram.api.errors import FloodWait
try: try:
... ...
except FloodWait as e: except FloodWait as e:
print(e.x) time.sleep(e.x)
**TODO: Better explanation on how to deal with exceptions** **TODO: Better explanation on how to deal with exceptions**

View File

@ -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: 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, - Create a new ``config.ini`` file at the root of your working directory, copy-paste the following and replace the
copy-paste the following and replace the **api_id** and **api_hash** values with `your own <#api-keys>`_: **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 .. 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_id = 12345
api_hash = 0123456789abcdef0123456789abcdef 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 .. code-block:: python