SubredditStream¶
- class praw.models.reddit.subreddit.SubredditStream(subreddit)¶
Provides submission and comment streams.
- Parameters:
subreddit (models.Subreddit)
- __init__(subreddit)¶
Initialize a
SubredditStreaminstance.- Parameters:
subreddit (
Subreddit) – The subreddit associated with the streams.- Return type:
None
- comments(**stream_options)¶
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 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:
for comment in reddit.subreddit("test").stream.comments(): print(comment)
To only retrieve new submissions starting when the stream is created, pass
skip_existing=True:subreddit = reddit.subreddit("test") for comment in subreddit.stream.comments(skip_existing=True): print(comment)
- submissions(**stream_options)¶
Yield new
Submissions 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 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:
for submission in reddit.subreddit("all").stream.submissions(): print(submission)
- Return type:
- Parameters:
stream_options (Any)