From d21c3e72d198c0ce3ad365231f10409b19c8e35f Mon Sep 17 00:00:00 2001 From: David Marx Date: Mon, 13 Aug 2018 21:33:43 -0700 Subject: [PATCH] Added demo for redditor_subreddit_activity, incremented version. --- CHANGES.rst | 4 ++-- README.rst | 29 +++++++++++++++++++++++++++++ psaw/__init__.py | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index ed66f50..5bcd510 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,12 +1,12 @@ Change Log ========== -dev +0.0.7 (2018/08/13) ------------------ * Add `redditor_subreddit_activity` convenience method - --> Needs demo in README * Fixed bug that blocked backoff on request issued to determine current rate limit when a new psaw instance is created. +* Fixed bug when using praw to get submission comments and no results returned. 0.0.6 (2018/08/06) ------------------ diff --git a/README.rst b/README.rst index 13d1425..1311926 100644 --- a/README.rst +++ b/README.rst @@ -171,6 +171,35 @@ will contain the aggs result. # {'doc_count': 1, 'key': 'reddit.com'}]} len(list(gen)) # 312 +Using the ``redditor_subreddit_activity`` convenience method +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you want to profile a redditors activity as in the ``aggs`` example, the +``redditor_subreddit_activity`` provides a simple shorthand for profiling a user by the subreddits +in which they are active, counting comments and submissions separately in a single call, +and returning Counter objects for commenting and posting activity, respectively. + + api = PushshiftAPI() + result = api.redditor_subreddit_activity('nasa') + result + #{'comment': + # Counter({ + # 'ExposurePorn': 1, + # 'IAmA': 300, + # 'Mars': 1, + # 'OldSchoolCool': 1, + # 'news': 1, + # 'pics': 1, + # 'reddit.com': 1, + # 'space': 6}), + # 'submission': + # Counter({ + # 'IAmA': 3, + # 'ISS': 1, + # 'Mars': 1, + # 'space': 3, + # 'u_nasa': 86})} + Using the ``stop_condition`` argument to get the most recent submission by a bot account ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/psaw/__init__.py b/psaw/__init__.py index 702df98..a3b317a 100644 --- a/psaw/__init__.py +++ b/psaw/__init__.py @@ -6,4 +6,4 @@ https://github.com/dmarx/psaw from .PushshiftAPI import PushshiftAPI, PushshiftAPIMinimal -__version__ = '0.0.6' +__version__ = '0.0.7'