SubredditFilters

class praw.models.reddit.subreddit.SubredditFilters(subreddit: praw.models.Subreddit)

Provide functions to interact with the special Subreddit’s filters.

Members of this class should be utilized via Subreddit.filters(). For example, to add a filter, run:

reddit.subreddit("all").filters.add("test")
__init__(subreddit: praw.models.Subreddit)

Initialize a SubredditFilters instance.

Parameters

subreddit – The special subreddit whose filters to work with.

As of this writing filters can only be used with the special subreddits all and mod.

__iter__() Generator[praw.models.Subreddit, None, None]

Iterate through the special Subreddit’s filters.

This method should be invoked as:

for subreddit in reddit.subreddit("test").filters:
    ...
add(subreddit: Union[praw.models.Subreddit, str])

Add subreddit to the list of filtered subreddits.

Parameters

subreddit – The subreddit to add to the filter list.

Items from subreddits added to the filtered list will no longer be included when obtaining listings for r/all.

Alternatively, you can filter a subreddit temporarily from a special listing in a manner like so:

reddit.subreddit("all-redditdev-learnpython")
Raises

prawcore.NotFound when calling on a non-special subreddit.

remove(subreddit: Union[praw.models.Subreddit, str])

Remove subreddit from the list of filtered subreddits.

Parameters

subreddit – The subreddit to remove from the filter list.

Raises

prawcore.NotFound when calling on a non-special subreddit.