https://github.com/danthedaniel/psraw
pushshift reddit API wrapper
https://github.com/danthedaniel/psraw
praw pushshift reddit
Last synced: 4 months ago
JSON representation
pushshift reddit API wrapper
- Host: GitHub
- URL: https://github.com/danthedaniel/psraw
- Owner: danthedaniel
- License: gpl-3.0
- Created: 2017-03-01T23:55:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-26T19:48:37.000Z (about 8 years ago)
- Last Synced: 2025-09-20T21:55:33.762Z (5 months ago)
- Topics: praw, pushshift, reddit
- Language: Python
- Size: 521 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PSRAW
===
[](https://badge.fury.io/py/psraw) [](https://coveralls.io/github/teaearlgraycold/psraw?branch=master) [](https://travis-ci.org/teaearlgraycold/psraw) [](https://landscape.io/github/teaearlgraycold/psraw/master)
pushshift reddit API wrapper
### Installation
psraw requires the installation of the `praw` package, so make sure
you have that installed first.
```bash
pip install psraw
```
*Both Python 2.7 and Python 3.X are supported*
### Usage
Each function in the library is a generator. This allows you to set an extremely
high limit parameter without the need to call the functions multiple times. To
get a normal Python list, just wrap the function with the `list()` constructor.
```python
import psraw
import praw
r = praw.Reddit(...)
# Get a list from the API
results = list(psraw.comment_search(r, q='teaearlgraycold', limit=30))
# Or use the function as a generator
for comment in psraw.comment_search(r, q='teaearlgraycold', limit=3000):
# Do something with the comment
```
### Available functions
[Official Documentation](https://docs.google.com/document/d/171VdjT-QKJi6ul9xYJ4kmiHeC7t_3G31Ce8eozKp3VQ/edit) *out of date*
In the example function signatures below, `r` is a `praw.Reddit` session object.
**All other arguments must be passed as keyword arguments.**
Each function will return either a list of `praw.models.Comment` objects or
`praw.models.Submission` objects.
```python
psraw.comment_search(r, q='', subreddit='', limit=0, sort='asc', after=0, before=0)
```
```python
psraw.submission_search(r, q='', subreddit='', limit=0, sort='asc', after=0)
```