Skip to content

(doc) Mention requiring closing Reddit http connection #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/getting_started/quick_start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ to read-only mode whenever you want:
If you are uncomfortable hard-coding your credentials into your program, there are
some options available to you. Please see: :ref:`configuration`.

Close Connections in :class:`.Reddit`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The asynchronous context requires closing your session when you finish using Reddit:

.. code-block:: python

reddit = asyncpraw.Reddit(...)
await reddit.close()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add using Reddit as an asynchronous context manager? I think there is an example in the docs for the Reddit class. If not, here's this:

async with asyncpraw.Reddit(...) as reddit:
    print(await reddit.user.me()

Obtain a :class:`.Subreddit`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down