Skip to content

v0.5.0-alpha

Pre-release
Pre-release
Compare
Choose a tag to compare
@Dan6erbond Dan6erbond released this 09 Jul 15:49
· 53 commits to master since this release

Update Log

aPRAWBase

  • aPRAWBase can now be loaded as lazy objects.
  • Added overridable method fetch() and implemented for class Comment, class Redditor, class Submission.
  • Private members were refactored with an _ (i.e. _reddit or _data).
  • The __repr__() method was implemented returning a string in the format of <{class} {id_attribute}='{id}'>.
  • Keeping track of attributes returned by the API with _data_attrs.

Comments

  • class Comment is now reactive based on the ReactivePy library.
    • Using Comment.on_change() or Comment.attribute.on_change(), change handlers can be assigned to the object and are called whenever a comment is refreshed and attributes change.
    • Comment.monitor() starts a loop based on the class ExponentialCounter used in streams to monitor a comment and repeatedly call fetch().

Comment Forrests:

  • The class CommentForrest was added as well as class MoreChildren, based on the class Listing.
    • Comment forests can contain class Comment as well as class MoreComments.
    • CommentForrest.replace_more() will replace all class MoreComments within the tree asynchronously.
    • class CommentForrest is used in Submission.comments as well as Comment.replies
    • class MoreChildren is a listing for responses from the /morechildren endpoint.
  • The class MoreComments acts as an async generator and will grab further comments in batches of 100 until the list has been exhausted.
    • Using MoreComments.comments() will fetch all the comments and return a flattened list.
    • MoreComments.parent() will return the parent submission or comment.
    • depth member attribute can be modified to adjust the depth of the comment tree when fetching more comments with class MoreComments.

Other

  • Add Reddit.close() to properly close open ClientSessions.

Fixes

  • Streams such as Subreddit.new.stream() were fixed as previously they would ignore all new posts.
  • User.get_auth_session() and get_client_session() are now asynchronous methods to ensure a running event loop.
  • Fix use of random.random() in class ExponentialCounter.

Tests

  • test_comment_forrest_replace_more was added using a large /r/facepalm thread.
  • Test comments were replaced by those made by the bot account to avoid failures based on online data.
  • Tests for old implementations of more children were removed.

Note: aPRAW v0.5.0-alpha has ReactivePy >= 1.9.0.dev0 as a requirement.