From 5f6788ad69da03f45e958794b042f60a71a15444 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:56:07 +0200 Subject: [PATCH] Improvements to the documentation --- compiler/docs/compiler.py | 2 +- ...-send-raised-exception-oserror-timeouterror.rst | 14 ++++++++------ docs/source/topics/advanced-usage.rst | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 4c632bff..78231f7d 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -310,7 +310,7 @@ def pyrogram_api(): """, advanced=""" Advanced - send + invoke resolve_peer save_file """ diff --git a/docs/source/faq/socket-send-raised-exception-oserror-timeouterror.rst b/docs/source/faq/socket-send-raised-exception-oserror-timeouterror.rst index e6a934d2..21ee1a90 100644 --- a/docs/source/faq/socket-send-raised-exception-oserror-timeouterror.rst +++ b/docs/source/faq/socket-send-raised-exception-oserror-timeouterror.rst @@ -1,10 +1,12 @@ socket.send() raised exception, OSError(), TimeoutError() ========================================================= -If you get this error chances are you are blocking the event loop for too long. -In general, it means you are executing thread-blocking code that prevents the event loop from -running properly. For example: +If you get this error chances are you are blocking the event loop for too long, most likely due to an improper use of +non-asynchronous or threaded operations which may lead to blocking code that prevents the event loop from running +properly. -- You are using ``time.sleep()`` instead of ``asyncio.sleep()``. -- You are running processing loops that take too much time to complete. -- You are reading/writing files to disk that take too much time to complete. \ No newline at end of file +You can consider the following: + +- Use Pyrogram asynchronously in its intended way. +- Use shorter non-asynchronous processing loops. +- Use ``asyncio.sleep()`` instead of ``time.sleep()``. diff --git a/docs/source/topics/advanced-usage.rst b/docs/source/topics/advanced-usage.rst index 0b0f0683..c84528e4 100644 --- a/docs/source/topics/advanced-usage.rst +++ b/docs/source/topics/advanced-usage.rst @@ -38,7 +38,7 @@ live in their respective packages (and sub-packages): ``pyrogram.raw.functions`` as Python classes, meaning you need to create an instance of each every time you need them and fill them in with the correct values using named arguments. -Next, to actually invoke the raw function you have to use the :meth:`~pyrogram.Client.send` method provided by the +Next, to actually invoke the raw function you have to use the :meth:`~pyrogram.Client.invoke` method provided by the Client class and pass the function object you created. Here's some examples: