Skip to content

Commit

Permalink
Add an example of the skip_existing argument to the comment stream docs
Browse files Browse the repository at this point in the history
There's a question every other week in /r/redditdev about how to skip existing comments in a stream since people don't know to check the streamgenerator docs.
  • Loading branch information
Watchful1 committed Nov 18, 2018
1 parent b825f10 commit 95ec577
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions praw/models/reddit/subreddit.py
Expand Up @@ -1841,6 +1841,15 @@ def comments(self, **stream_options):
for comment in reddit.subreddit('iama').stream.comments():
print(comment)
To only retreive new submissions starting when the stream is
created, pass `skip_existing=true`:
.. code:: python
subreddit = reddit.subreddit('iama')
for comment in subreddit.stream.comments(skip_existing=true):
print(comment)
"""
return stream_generator(self.subreddit.comments, **stream_options)

Expand Down

0 comments on commit 95ec577

Please sign in to comment.