SubredditListingMixin

class praw.models.listing.mixins.subreddit.SubredditListingMixin(reddit, _data)

Adds additional methods pertaining to subreddit-like instances.

Parameters:
__init__(reddit, _data)

Initialize a SubredditListingMixin instance.

Parameters:
Return type:

None

comments()

Provide an instance of CommentHelper.

For example, to output the author of the 25 most recent comments of r/test execute:

for comment in reddit.subreddit("test").comments(limit=25):
    print(comment.author)
Return type:

CommentHelper

controversial(*, time_filter='all', **generator_kwargs)

Return a ListingGenerator for controversial items.

Parameters:
  • time_filter (str) – Can be one of: "all", "day", "hour", "month", "week", or "year" (default: "all").

  • generator_kwargs (str | int | dict[str, str])

Raises:

ValueError if time_filter is invalid.

Return type:

Iterator[Any]

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").controversial(time_filter="week")
reddit.multireddit(redditor="samuraisam", name="programming").controversial(
    time_filter="day"
)
reddit.redditor("spez").controversial(time_filter="month")
reddit.redditor("spez").comments.controversial(time_filter="year")
reddit.redditor("spez").submissions.controversial(time_filter="all")
reddit.subreddit("all").controversial(time_filter="hour")
hot(**generator_kwargs)

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()
reddit.multireddit(redditor="samuraisam", name="programming").hot()
reddit.redditor("spez").hot()
reddit.redditor("spez").comments.hot()
reddit.redditor("spez").submissions.hot()
reddit.subreddit("all").hot()
Return type:

Iterator[Any]

Parameters:

generator_kwargs (str | int | dict[str, str])

new(**generator_kwargs)

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()
reddit.multireddit(redditor="samuraisam", name="programming").new()
reddit.redditor("spez").new()
reddit.redditor("spez").comments.new()
reddit.redditor("spez").submissions.new()
reddit.subreddit("all").new()
Return type:

Iterator[Any]

Parameters:

generator_kwargs (str | int | dict[str, str])

classmethod parse(data, reddit)

Return an instance of cls from data.

Parameters:
Return type:

PRAWBase

rising(**generator_kwargs)

Return a ListingGenerator for rising submissions.

Additional keyword arguments are passed in the initialization of ListingGenerator.

For example, to get rising submissions for r/test:

for submission in reddit.subreddit("test").rising():
    print(submission.title)
Return type:

Iterator[Submission]

Parameters:

generator_kwargs (str | int | dict[str, str])

top(*, time_filter='all', **generator_kwargs)

Return a ListingGenerator for top items.

Parameters:
  • time_filter (str) – Can be one of: "all", "day", "hour", "month", "week", or "year" (default: "all").

  • generator_kwargs (str | int | dict[str, str])

Raises:

ValueError if time_filter is invalid.

Return type:

Iterator[Any]

Additional keyword arguments are passed in the initialization of ListingGenerator.

This method can be used like:

reddit.domain("imgur.com").top(time_filter="week")
reddit.multireddit(redditor="samuraisam", name="programming").top(time_filter="day")
reddit.redditor("spez").top(time_filter="month")
reddit.redditor("spez").comments.top(time_filter="year")
reddit.redditor("spez").submissions.top(time_filter="all")
reddit.subreddit("all").top(time_filter="hour")