diff options
| author | NCPlayz <[email protected]> | 2019-05-18 06:04:54 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-06-07 19:27:46 -0400 |
| commit | 3c9bcc285147154a2980f6e661efdfa676672b6a (patch) | |
| tree | 657bafa75e4e0d45361e394443ea932ad70e86a7 /docs/faq.rst | |
| parent | Added comment for/redo system information (diff) | |
| download | discord.py-3c9bcc285147154a2980f6e661efdfa676672b6a.tar.xz discord.py-3c9bcc285147154a2980f6e661efdfa676672b6a.zip | |
Improve documentation
Diffstat (limited to 'docs/faq.rst')
| -rw-r--r-- | docs/faq.rst | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/faq.rst b/docs/faq.rst index 6e6f2c22..c8aeafc8 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -18,7 +18,7 @@ Questions regarding coroutines and asyncio belong here. What is a coroutine? ~~~~~~~~~~~~~~~~~~~~~~ -A coroutine is a function that must be invoked with ``await`` or ``yield from``. When Python encounters an ``await`` it stops +A |coroutine_link|_ is a function that must be invoked with ``await`` or ``yield from``. When Python encounters an ``await`` it stops the function's execution at that point and works on other things until it comes back to that point and finishes off its work. This allows for your program to be doing multiple things at the same time without using threads or complicated multiprocessing. @@ -51,9 +51,10 @@ instead. Similar to this example: :: # good await asyncio.sleep(10) -Another common source of blocking for too long is using HTTP requests with the famous module ``requests``. While ``requests`` -is an amazing module for non-asynchronous programming, it is not a good choice for :mod:`asyncio` because certain requests can -block the event loop too long. Instead, use the ``aiohttp`` library which is installed on the side with this library. +Another common source of blocking for too long is using HTTP requests with the famous module :doc:`req:index`. +While :doc:`req:index` is an amazing module for non-asynchronous programming, it is not a good choice for +:mod:`asyncio` because certain requests can block the event loop too long. Instead, use the :doc:`aiohttp <aio:index>` library which +is installed on the side with this library. Consider the following example: :: @@ -128,7 +129,7 @@ To upload multiple files, you can use the ``files`` keyword argument instead of ] await channel.send(files=my_files) -If you want to upload something from a URL, you will have to use an HTTP request using ``aiohttp`` +If you want to upload something from a URL, you will have to use an HTTP request using :doc:`aiohttp <aio:index>` and then pass an :class:`io.BytesIO` instance to :class:`File` like so: .. code-block:: python3 |