SubredditStream
- class asyncpraw.models.reddit.subreddit.SubredditStream(subreddit: asyncpraw.models.Subreddit)
Provides submission and comment streams.
- __init__(subreddit: asyncpraw.models.Subreddit)
Initialize a
SubredditStream
instance.- Parameters:
subreddit – The subreddit associated with the streams.
- comments(**stream_options: Any) AsyncGenerator[asyncpraw.models.Comment, None]
Yield new comments as they become available.
Comments are yielded oldest first. Up to 100 historical comments will initially be returned.
Keyword arguments are passed to
stream_generator()
.Note
While Async PRAW tries to catch all new comments, some high-volume streams, especially the r/all stream, may drop some comments.
For example, to retrieve all new comments made to r/test, try:
subreddit = await reddit.subreddit("test") async for comment in subreddit.stream.comments(): print(comment)
To only retrieve new submissions starting when the stream is created, pass
skip_existing=True
:subreddit = await reddit.subreddit("test") async for comment in subreddit.stream.comments(skip_existing=True): print(comment)
- submissions(**stream_options: Any) AsyncGenerator[asyncpraw.models.Submission, None]
Yield new
Submission
s as they become available.Submissions are yielded oldest first. Up to 100 historical submissions will initially be returned.
Keyword arguments are passed to
stream_generator()
.Note
While Async PRAW tries to catch all new submissions, some high-volume streams, especially the r/all stream, may drop some submissions.
For example, to retrieve all new submissions made to all of Reddit, try:
subreddit = await reddit.subreddit("all") async for submission in subreddit.stream.submissions(): print(submission)