mirror of
https://github.com/wassname/psaw.git
synced 2026-10-29 13:31:04 +08:00
Added aggs support to _search
This commit is contained in:
1 parent
a110db8a37
commit
4e7731f3a4
2 files changed
+14
-1
No files matched your search
@@ -1,6 +1,14 @@
|
||||
Change Log
|
||||
==========
|
||||
|
||||
x.x.x (????/??/??)
|
||||
------------------
|
||||
* Fixed (added?) `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
|
||||
way to page for additional results.
|
||||
|
||||
0.0.5 (2018/08/05)
|
||||
------------------
|
||||
* New parameter documentation added to README.
|
||||
|
||||
@@ -178,8 +178,13 @@ class PushshiftAPIMinimal(object):
|
||||
self.payload = copy.deepcopy(kwargs)
|
||||
endpoint = 'reddit/{}/search'.format(kind)
|
||||
url = self.base_url.format(endpoint=endpoint)
|
||||
|
||||
for response in self._handle_paging(url):
|
||||
if 'aggs' in response:
|
||||
yield response['aggs']
|
||||
# Aggs responses are unreliable in subsequent batches with
|
||||
# current search paging implementation. Enforce aggs result
|
||||
# is only returned once.
|
||||
self.payload.pop('aggs')
|
||||
results = response['data']
|
||||
if len(results) == 0:
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user