praw-dev / praw

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.
http://praw.readthedocs.io/
BSD 2-Clause "Simplified" License
3.4k stars 453 forks source link

Support for an initial before_attribute in stream_generator #1983

Closed c0d3rman closed 9 months ago

c0d3rman commented 9 months ago

Adds a continue_after_id parameter to the stream_generator function so that an initial value for before_attribute can be set.

Example use case: a script wants to process all new comments from a sub since the last time it's been run. It keeps the fullname of the last comment it saw on its previous run and wants to stream all comments starting from the one after that. It can do:

for comment in reddit.sub.stream.comments(continue_after_id=last_seen_fullname):
    # Do things...
c0d3rman commented 9 months ago

For CHANGES.rst, should I increment the version number? (And if so do I need to do that elsewhere as well?) Or should I put it in Unreleased?

LilSpazJoekp commented 9 months ago

Put it in unreleased under the **Added** header.

c0d3rman commented 9 months ago

Requested changes have been made.

LilSpazJoekp commented 9 months ago

Merged in! 🎉Thank you!

c0d3rman commented 9 months ago

Thanks for all your help!

c0d3rman commented 9 months ago

By the way, question: what's the release schedule of PRAW like? I want to use this in a project of mine but not sure if to just wait or to hack around it in the meantime

LilSpazJoekp commented 9 months ago

There isn't really a release schedule. However, you can do pip install --upgrade https://github.com/praw-dev/praw/archive/master.zip to install the dev version.