Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

small error in documentation, "after" parameter #94

Open
paul-rottger opened this issue Mar 22, 2021 · 1 comment · May be fixed by #98
Open

small error in documentation, "after" parameter #94

paul-rottger opened this issue Mar 22, 2021 · 1 comment · May be fixed by #98

Comments

@paul-rottger
Copy link

The example you give for "First 10 submissions to /r/politics in 2017, filtering results to url/author/title/subreddit fields." actually returns the 10 most recent submissions. The after parameter appears to not specify the starting point but rather the furthest back that the search will go. If you replaced after with before, that would return the 10 most recent submissions leading up to the specified datetime.

Thanks for putting this together :)

@CDeLeon94
Copy link

If you don't set a sort when calling search_submissions() it defaults to 'desc' which appears to be causing the unintended behavior.

psaw/psaw/PushshiftAPI.py

Lines 162 to 164 in 53df79d

if 'sort' not in payload:
# Getting weird results if this is not made explicit. Unclear why.
payload['sort'] = 'desc'

It seems to me that, if you're going to use before you'll want to pair it with sort=desc, and after pairs with sort=asc

@CDeLeon94 CDeLeon94 linked a pull request Aug 4, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants