Skip to content

Commit

Permalink
Add code examples to the User class
Browse files Browse the repository at this point in the history
The methods `User.contributor_subreddits` and `User.subreddits` need to
use either an explicit limit or a limit of None in order to retrieve more than
100 subreddits.

(cherry picked from commit 1bceed35e830837dd16ae50315fc2671d4e4ac81)
  • Loading branch information
MaybeNetwork authored and LilSpazJoekp committed Jul 28, 2021
1 parent bfe4be2 commit 9315911
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion asyncpraw/models/user.py
Expand Up @@ -65,11 +65,18 @@ def contributor_subreddits(
) -> AsyncIterator["asyncpraw.models.Subreddit"]:
"""Return a :class:`.ListingGenerator` of contributor subreddits.
These are subreddits that the user is a contributor of.
These are subreddits in which the user is an approved user.
Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.
To print a list of the subreddits that you are an approved user in, try:
.. code-block:: python
async for subreddit in reddit.user.contributor_subreddits(limit=None):
print(str(subreddit))
"""
return ListingGenerator(
self._reddit, API_PATH["my_contributor"], **generator_kwargs
Expand Down Expand Up @@ -193,6 +200,13 @@ def subreddits(
Additional keyword arguments are passed in the initialization of
:class:`.ListingGenerator`.
To print a list of the subreddits that you are subscribed to, try:
.. code-block:: python
async for subreddit in reddit.user.subreddits(limit=None):
print(str(subreddit))
"""
return ListingGenerator(
self._reddit, API_PATH["my_subreddits"], **generator_kwargs
Expand Down

0 comments on commit 9315911

Please sign in to comment.