SubredditFilters
- class asyncpraw.models.reddit.subreddit.SubredditFilters(subreddit: asyncpraw.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:subreddit = await reddit.subreddit("all") await subreddit.filters.add("test")
- __init__(subreddit: asyncpraw.models.Subreddit)
Initialize a
SubredditFiltersinstance.- Parameters
subreddit – The special subreddit whose filters to work with.
As of this writing filters can only be used with the special subreddits
allandmod.
- await add(subreddit: Union[asyncpraw.models.Subreddit, str])
Add
subredditto 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:
await reddit.subreddit("all-redditdev-learnpython")
- Raises
asyncprawcore.NotFoundwhen calling on a non-special subreddit.
- await remove(subreddit: Union[asyncpraw.models.Subreddit, str])
Remove
subredditfrom the list of filtered subreddits.- Parameters
subreddit – The subreddit to remove from the filter list.
- Raises
asyncprawcore.NotFoundwhen calling on a non-special subreddit.