diff --git a/docs/source/resources/ErrorHandling.rst b/docs/source/resources/ErrorHandling.rst index 71a3b7a7..0d5cf6f9 100644 --- a/docs/source/resources/ErrorHandling.rst +++ b/docs/source/resources/ErrorHandling.rst @@ -43,17 +43,18 @@ Examples except UnknownError: pass -Exceptions may also contain some informative values which can be useful. -e.g. :obj:`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 ` 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** \ No newline at end of file diff --git a/docs/source/start/ProjectSetup.rst b/docs/source/start/ProjectSetup.rst index 2899fb7a..3d0dea32 100644 --- a/docs/source/start/ProjectSetup.rst +++ b/docs/source/start/ProjectSetup.rst @@ -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