Skip to content

danthedaniel/psraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSRAW

PyPI version Coverage Status Build Status Code Health

pushshift reddit API wrapper

Installation

psraw requires the installation of the praw package, so make sure you have that installed first.

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.

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 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.

psraw.comment_search(r, q='', subreddit='', limit=0, sort='asc', after=0, before=0)
psraw.submission_search(r, q='', subreddit='', limit=0, sort='asc', after=0)