reddit.subreddits

class praw.models.Subreddits(reddit, _data)

Subreddits is a Listing class that provides various subreddit lists.

__init__(reddit, _data)

Initialize a PRAWModel instance.

Parameters:reddit – An instance of Reddit.
default(**generator_kwargs)

Return a ListingGenerator for default subreddits.

gold(**generator_kwargs)

Return a ListingGenerator for gold subreddits.

new(**generator_kwargs)

Return a ListingGenerator for new subreddits.

classmethod parse(data, reddit)

Return an instance of cls from data.

Parameters:
  • data – The structured data.
  • reddit – An instance of Reddit.
popular(**generator_kwargs)

Return a ListingGenerator for popular subreddits.

recommended(subreddits, omit_subreddits=None)

Return subreddits recommended for the given list of subreddits.

Parameters:
  • subreddits – A list of Subreddit instances and/or subreddit names.
  • omit_subreddits – A list of Subreddit instances and/or subreddit names to exclude from the results (Reddit’s end may not work as expected).
search(query, **generator_kwargs)

Return a ListingGenerator of subreddits matching query.

Subreddits are searched by both their title and description. To search names only see search_by_name.

Parameters:query – The query string to filter subreddits by.
search_by_name(query, include_nsfw=True, exact=False)

Return list of Subreddits whose names begin with query.

Parameters:
  • query – Search for subreddits beginning with this string.
  • include_nsfw – Include subreddits labeled NSFW (default: True).
  • exact – Return only exact matches to query (default: False).
search_by_topic(query)

Return list of Subreddits whose topics match query.

Parameters:query – Search for subreddits relevant to the search topic.
stream(**stream_options)

Yield new subreddits as they are created.

Subreddits are yielded oldest first. Up to 100 historical subreddits will initially be returned.

Keyword arguments are passed to stream_generator().