Package: praw
PRAW, an acronym for “Python Reddit API Wrapper”, is a Python package that allows for
simple access to Reddit’s API. PRAW aims to be easy to use and internally follows all ofReddit’s API rules. With PRAW there’s no
need to introducesleepcalls in your code. Give your client an appropriate user
agent and you’re set.InstallationPRAW is supported on Python 3.7+. The recommended way to install PRAW is viapip.pipinstallprawTo install the latest development version of PRAW run the following instead:pipinstall--upgradehttps://github.com/praw-dev/praw/archive/master.zipFor instructions on installing Python and pip see “The Hitchhiker’s Guide to Python”Installation Guides.QuickstartAssuming you already have a credentials for a script-type OAuth application you can
instantiate an instance of PRAW like so:importprawreddit=praw.Reddit(client_id="CLIENT_ID",client_secret="CLIENT_SECRET",password="PASSWORD",user_agent="USERAGENT",username="USERNAME",)With theredditinstance you can then interact with Reddit:# Create a submission to r/testreddit.subreddit("test").submit("Test Submission",url="https://reddit.com")# Comment on a known submissionsubmission=reddit.submission(url="https://www.reddit.com/comments/5e1az9")submission.reply("Super rad!")# Reply to the first comment of a weekly top thread of a moderated communitysubmission=next(reddit.subreddit("mod").top(time_filter="week"))submission.comments[0].reply("An automated reply")# Output score for the first 256 items on the frontpageforsubmissioninreddit.front.hot(limit=256):print(submission.score)# Obtain the moderator listing for r/testformoderatorinreddit.subreddit("test").moderator():print(moderator)Please see PRAW’sdocumentationfor more examples of
what you can do with PRAW.Discord Bots and Asynchronous EnvironmentsIf you plan on using PRAW in an asynchronous environment, (e.g., discord.py, asyncio) it
is strongly recommended to useAsync PRAW. It is
the official asynchronous version of PRAW and its usage is similar and has the same
features as PRAW.PRAW Discussion and SupportFor those new to Python, or would otherwise consider themselves a Python beginner,
please consider asking questions on ther/learnpythonsubreddit. There are wonderful people there who
can help with general Python and simple PRAW related questions.Otherwise, there are a few official places to ask questions about PRAW:r/redditdevis the best place on Reddit to ask
PRAW related questions. This subreddit is for all Reddit API related discussion so
please tag submissions with[PRAW]. Please perform a search on the subreddit first to
see if anyone has similar questions.Real-time chat can be conducted via thePRAW Slack Organization(please create an issue if that invite link has expired).Please do not directly message any of the contributors via Reddit, email, or Slack
unless they have indicated otherwise. We strongly encourage everyone to help others with
their questions.Please file bugs and feature requests as issues onGitHubafter first searching to ensure a similar
issue was not already filed. If such an issue already exists please give it a thumbs up
reaction. Comments to issues containing additional information are certainly welcome.NoteThis project is released with aContributor Code of Conduct. By
participating in this project you agree to abide by its terms.DocumentationPRAW’s documentation is located athttps://praw.readthedocs.io/.HistoryAugust 2010:
Timothy Mellor created a github project calledreddit_api.March 2011:
The Python packageredditwas registered and uploaded to pypi.December 2011:
Bryce Boe took over as maintainer of theredditpackage.June 2012:
Bryce renamed the projectPRAWand the repository was relocated to the newly created
praw-dev organization on GitHub.February 2016:
Bryce began work on PRAW4, a complete rewrite of PRAW.LicensePRAW’s source (v4.0.0+) is provided under theSimplified BSD License.Copyright ©, 2016, Bryce BoeEarlier versions of PRAW were released underGPLv3.Sponsors