File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,25 @@ to read-only mode whenever you want:
157157 If you are uncomfortable hard-coding your credentials into your program, there are
158158 some options available to you. Please see: :ref: `configuration `.
159159
160+ Close Connections in :class: `.Reddit `
161+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162+
163+ The asynchronous context requires closing your session when you finish using Reddit:
164+
165+ .. code-block :: python
166+
167+ reddit = asyncpraw.Reddit(... )
168+ await reddit.close()
169+
170+ Or, you can use an asynchronous context manager:
171+
172+ .. code-block :: python
173+
174+ async with asyncpraw.Reddit(... ) as reddit:
175+ # do stuff with `reddit`
176+ print (await reddit.user.me())
177+ # connection is closed
178+
160179 Obtain a :class: `.Subreddit `
161180~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162181
You can’t perform that action at this time.
0 commit comments