Multireddit
- class asyncpraw.models.Multireddit(reddit: asyncpraw.Reddit, _data: Dict[str, Any])
A class for users’ Multireddits.
This is referred to as a Custom Feed on the Reddit UI.
Typical Attributes
This table describes attributes that typically belong to objects of this class. Since attributes are dynamically provided (see Determine Available Attributes of an Object), there is not a guarantee that these attributes will always be present, nor is this list necessarily complete.
Attribute
Description
can_edit
A
bool
representing whether or not the authenticated user may edit the multireddit.copied_from
The multireddit that the multireddit was copied from, if it exists, otherwise
None
.created_utc
When the multireddit was created, in Unix Time.
description_html
The description of the multireddit, as HTML.
description_md
The description of the multireddit, as Markdown.
display_name
The display name of the multireddit.
name
The name of the multireddit.
over_18
A
bool
representing whether or not the multireddit is restricted for users over 18.subreddits
A
list
ofSubreddit
s that make up the multireddit.visibility
The visibility of the multireddit, either
private
,public
, orhidden
.- __init__(reddit: asyncpraw.Reddit, _data: Dict[str, Any])
Construct an instance of the Multireddit object.
- await add(subreddit: asyncpraw.models.Subreddit)
Add a subreddit to this multireddit.
- Parameters
subreddit – The subreddit to add to this multi.
For example, to add subreddit
r/test
to multiredditbboe/test
:subreddit = await reddit.subreddit("test") multireddit = await reddit.multireddit("bboe", "test") await multireddit.add(subreddit)
- comments() asyncpraw.models.listing.mixins.subreddit.CommentHelper
Provide an instance of
CommentHelper
.For example, to output the author of the 25 most recent comments of
r/redditdev
execute:subreddit = await reddit.subreddit("redditdev") async for comment in subreddit.comments(limit=25): print(comment.author)
- controversial(time_filter: str = 'all', **generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[Any]
Return a
ListingGenerator
for controversial submissions.- Parameters
time_filter – Can be one of: all, day, hour, month, week, year (default: all).
- Raises
ValueError
iftime_filter
is invalid.
Additional keyword arguments are passed in the initialization of
ListingGenerator
.This method can be used like:
reddit.domain("imgur.com").controversial("week") multireddit = await reddit.multireddit("samuraisam", "programming") multireddit.controversial("day") redditor = await reddit.redditor("spez") redditor.controversial("month") redditor = await reddit.redditor("spez") redditor.comments.controversial("year") redditor = await reddit.redditor("spez") redditor.submissions.controversial("all") subreddit = await reddit.subreddit("all") subreddit.controversial("hour")
- await copy(display_name: Optional[str] = None) asyncpraw.models.Multireddit
Copy this multireddit and return the new multireddit.
- Parameters
display_name – (optional) The display name for the copied multireddit. Reddit will generate the
name
field from this display name. When not provided the copy will use the same display name and name as this multireddit.
To copy the multireddit
bboe/test
with a name oftesting
:multireddit = await reddit.multireddit("bboe", "test") await multireddit.copy("testing")
- await delete()
Delete this multireddit.
For example, to delete multireddit``bboe/test``:
multireddit = await reddit.multireddit("bboe", "test") await multireddit.delete()
- gilded(**generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[Any]
Return a
ListingGenerator
for gilded items.Additional keyword arguments are passed in the initialization of
ListingGenerator
.For example, to get gilded items in subreddit
r/test
:subreddit = await reddit.subreddit("test") async for item in subreddit.gilded(): print(item.id)
- hot(**generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[Any]
Return a
ListingGenerator
for hot items.Additional keyword arguments are passed in the initialization of
ListingGenerator
.This method can be used like:
reddit.domain("imgur.com").hot() multireddit = await reddit.multireddit("samuraisam", "programming") multireddit.hot() redditor = await reddit.redditor("spez") redditor.hot() redditor = await reddit.redditor("spez") redditor.comments.hot() redditor = await reddit.redditor("spez") redditor.submissions.hot() subreddit = await reddit.subreddit("all") subreddit.hot()
- await load()
Re-fetches the object.
This is used to explicitly fetch or re-fetch the object from reddit. This method can be used on any
RedditBase
object.await reddit_base_object.load()
- new(**generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[Any]
Return a
ListingGenerator
for new items.Additional keyword arguments are passed in the initialization of
ListingGenerator
.This method can be used like:
reddit.domain("imgur.com").new() multireddit = await reddit.multireddit("samuraisam", "programming") multireddit.new() redditor = await reddit.redditor("spez") redditor.new() redditor = await reddit.redditor("spez") redditor.comments.new() redditor = await reddit.redditor("spez") redditor.submissions.new() subreddit = await reddit.subreddit("all") subreddit.new()
- classmethod parse(data: Dict[str, Any], reddit: asyncpraw.Reddit) Any
Return an instance of
cls
fromdata
.- Parameters
data – The structured data.
reddit – An instance of
Reddit
.
- random_rising(**generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[asyncpraw.models.Submission]
Return a
ListingGenerator
for random rising submissions.Additional keyword arguments are passed in the initialization of
ListingGenerator
.For example, to get random rising submissions for subreddit
r/test
:subreddit = await reddit.subreddit("test") async for submission in subreddit.random_rising(): print(submission.title)
- await remove(subreddit: asyncpraw.models.Subreddit)
Remove a subreddit from this multireddit.
- Parameters
subreddit – The subreddit to remove from this multi.
For example, to remove subreddit
r/test
from multiredditbboe/test
:subreddit = await reddit.subreddit("test") multireddit = await reddit.multireddit("bboe", "test") await multireddit.remove(subreddit)
- rising(**generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[asyncpraw.models.Submission]
Return a
ListingGenerator
for rising submissions.Additional keyword arguments are passed in the initialization of
ListingGenerator
.For example, to get rising submissions for subreddit
r/test
:subreddit = await reddit.subreddit("test") async for submission in subreddit.rising(): print(submission.title)
- staticmethod sluggify(title: str)
Return a slug version of the title.
- Parameters
title – The title to make a slug of.
Adapted from reddit’s utils.py.
- stream() asyncpraw.models.reddit.subreddit.SubredditStream
Provide an instance of
SubredditStream
.Streams can be used to indefinitely retrieve new comments made to a multireddit, like:
multireddit = await reddit.multireddit("spez", "fun") async for comment in multireddit.stream.comments(): print(comment)
Additionally, new submissions can be retrieved via the stream. In the following example all new submissions to the multireddit are fetched:
multireddit = await reddit.multireddit("bboe", "games") async for submission in multireddit.stream.submissions(): print(submission)
- top(time_filter: str = 'all', **generator_kwargs: Union[str, int, Dict[str, str]]) AsyncIterator[Any]
Return a
ListingGenerator
for top submissions.- Parameters
time_filter – Can be one of: all, day, hour, month, week, year (default: all).
- Raises
ValueError
iftime_filter
is invalid.
Additional keyword arguments are passed in the initialization of
ListingGenerator
.This method can be used like:
reddit.domain("imgur.com").top("week") multireddit = await reddit.multireddit("samuraisam", "programming") multireddit.top("day") redditor = await reddit.redditor("spez") redditor.top("month") redditor = await reddit.redditor("spez") redditor.comments.top("year") redditor = await reddit.redditor("spez") redditor.submissions.top("all") subreddit = await reddit.subreddit("all") subreddit.top("hour")
- await update(**updated_settings: Union[str, List[Union[str, asyncpraw.models.Subreddit, Dict[str, str]]]])
Update this multireddit.
Keyword arguments are passed for settings that should be updated. They can any of:
- Parameters
display_name – The display name for this multireddit. Must be no longer than 50 characters.
subreddits – Subreddits for this multireddit.
description_md – Description for this multireddit, formatted in Markdown.
icon_name – Can be one of:
art and design
,ask
,books
,business
,cars
,comics
,cute animals
,diy
,entertainment
,food and drink
,funny
,games
,grooming
,health
,life advice
,military
,models pinup
,music
,news
,philosophy
,pictures and gifs
,science
,shopping
,sports
,style
,tech
,travel
,unusual stories
,video
, orNone
.key_color – RGB hex color code of the form
"#FFFFFF"
.visibility – Can be one of:
hidden
,private
,public
.weighting_scheme – Can be one of:
classic
,fresh
.
For example, to rename multireddit
bboe/test
tobboe/testing
:multireddit = await reddit.multireddit("bboe", "test") await multireddit.update(display_name="testing")
Note
This list of attributes is not complete. Async PRAW dynamically provides the attributes that Reddit returns via the API. Because those attributes are subject to change on Reddit’s end, Async PRAW makes no effort to document them, other than to instruct you on how to discover what is available. See Determine Available Attributes of an Object for detailed information.