From 891af80a31b4921d906701ce448200f5b01701cf Mon Sep 17 00:00:00 2001 From: David Marx Date: Mon, 6 Aug 2018 01:47:16 -0700 Subject: [PATCH] Ensured sort is always explicit to fix some new unusual behavior. --- CHANGES.rst | 2 +- psaw/PushshiftAPI.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 31bc5fa..29fe89b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,7 +3,7 @@ Change Log x.x.x (????/??/??) ------------------ -* Fixed (added?) `aggs` support. +* Fixed `aggs` support. * If an aggs parameter is provided to a search method, it will be returned as the first result. * Subsequent results will be yielded as though there was no aggs parameter. * To the best of my understanding, PushShift only returns 100 results per agg, and there is not diff --git a/psaw/PushshiftAPI.py b/psaw/PushshiftAPI.py index 8aa1465..e79ead9 100644 --- a/psaw/PushshiftAPI.py +++ b/psaw/PushshiftAPI.py @@ -134,6 +134,9 @@ class PushshiftAPIMinimal(object): return if 'limit' not in payload: payload['limit'] = self.max_results_per_request + if 'sort' not in payload: + # Getting weird results if this is not made explicit. Unclear why. + payload['sort'] = 'desc' if 'filter' in payload: #and payload.get('created_utc', None) is None: if not isinstance(payload['filter'], list): if isinstance(payload['filter'], str):