README.rst
1PRAW: The Python Reddit API Wrapper
2===================================
3
4.. image:: https://img.shields.io/pypi/v/praw.svg
5 :alt: Latest PRAW Version
6 :target: https://pypi.python.org/pypi/praw
7.. image:: https://travis-ci.org/praw-dev/praw.svg?branch=master
8 :alt: Travis CI Status
9 :target: https://travis-ci.org/praw-dev/praw
10.. image:: https://coveralls.io/repos/github/praw-dev/praw/badge.svg?branch=master
11 :alt: Coveralls Coverage
12 :target: https://coveralls.io/github/praw-dev/praw?branch=master
13.. image:: https://badges.gitter.im/praw-dev/praw.svg
14 :alt: Join the chat at https://gitter.im/praw-dev/praw
15 :target: https://gitter.im/praw-dev/praw
16
17PRAW, an acronym for "Python Reddit API Wrapper", is a python package that
18allows for simple access to Reddit's API. PRAW aims to be easy to use and
19internally follows all of `Reddit's API rules
20<https://github.com/reddit/reddit/wiki/API>`_. With PRAW there's no need to
21introduce ``sleep`` calls in your code. Give your client an appropriate user
22agent and you're set.
23
24.. _installation:
25
26Installation
27------------
28
29PRAW is supported on python 2.7, 3.3, 3.4, 3.5 and 3.6. The recommended way to
30install PRAW is via `pip <https://pypi.python.org/pypi/pip>`_.
31
32.. code-block:: bash
33
34 pip install praw
35
36To install the latest development version of PRAW run the following instead:
37
38.. code-block:: bash
39
40 pip install --upgrade https://github.com/praw-dev/praw/archive/master.zip
41
42For instructions on installing python and pip see "The Hitchhiker's Guide to
43Python" `Installation Guides
44<http://docs.python-guide.org/en/latest/starting/installation/>`_.
45
46Quickstart
47----------
48
49Assuming you already have a credentials for a script-type OAuth application you
50can instantiate an instance of PRAW like so:
51
52.. code-block:: python
53
54 import praw
55 reddit = praw.Reddit(client_id='CLIENT_ID', client_secret="CLIENT_SECRET",
56 password='PASSWORD', user_agent='USERAGENT',
57 username='USERNAME')
58
59With the ``reddit`` instance you can then interact with Reddit:
60
61.. code-block:: python
62
63 # Create a submission to /r/test
64 reddit.subreddit('test').submit('Test Submission', url='https://reddit.com')
65
66 # Comment on a known submission
67 submission = reddit.submission(url='https://www.reddit.com/comments/5e1az9')
68 submission.reply('Super rad!')
69
70 # Reply to the first comment of a weekly top thread of a moderated community
71 submission = next(reddit.subreddit('mod').top('week'))
72 submission.comments[0].reply('An automated reply')
73
74 # Output score for the first 256 items on the frontpage
75 for submission in reddit.front.hot(limit=256):
76 print(submission.score)
77
78 # Obtain the moderator listing for redditdev
79 for moderator in reddit.subreddit('redditdev').moderator:
80 print(moderator)
81
82Please see PRAW's `documentation <http://praw.readthedocs.io/>`_ for
83more examples of what you can do with PRAW.
84
85PRAW Discussion and Support
86---------------------------
87
88For those new to python, or would otherwise consider themselves a python
89beginner, please consider asking questions on the `r/learnpython
90<https://www.reddit.com/r/learnpython>`_ subreddit. There are wonderful people
91there who can help with general python and simple PRAW related questions.
92
93Otherwise, there are a few official places to ask questions about PRAW:
94
95`/r/redditdev <https://www.reddit.com/r/redditdev>`_ is the best place on
96Reddit to ask PRAW related questions. This subreddit is for all Reddit API
97related discussion so please tag submissions with *[PRAW]*. Please perform a
98search on the subreddit first to see if anyone has similar questions.
99
100Real-time chat can be conducted via the `praw-dev/praw
101<https://gitter.im/praw-dev/praw>`_ channel on gitter.
102
103Please do not directly message any of the contributors via Reddit, email, or
104gitter unless they have indicated otherwise. We strongly encourage everyone to
105help others with their questions.
106
107Please file bugs and feature requests as issues on `GitHub
108<https://github.com/praw-dev/praw/issues>`_ after first searching to ensure a
109similar issue was not already filed. If such an issue already exists please
110give it a thumbs up reaction. Comments to issues containing additional
111information are certainly welcome.
112
113.. note:: This project is released with a `Contributor Code of Conduct
114 <https://github.com/praw-dev/praw/blob/master/CODE_OF_CONDUCT.md>`_. By
115 participating in this project you agree to abide by its terms.
116
117Documentation
118-------------
119
120PRAW's documentation is located at http://praw.readthedocs.io/.
121
122History
123-------
124
125`August 2010
126<https://github.com/praw-dev/praw/commit/efef08a4a713fcfd7dfddf992097cf89426586ae>`_:
127Timothy Mellor created a github project called ``reddit_api``.
128
129`March 2011
130<https://github.com/praw-dev/praw/commit/ebfc9caba5b58b9e68c77af9c8e53f5562a2ee64>`_:
131The python package ``reddit`` was registered and uploaded to pypi.
132
133`December 2011
134<https://github.com/praw-dev/praw/commit/74bb962b3eefe04ce6acad88e6f53f43d10c8803>`_:
135Bryce Boe took over as maintainer of the ``reddit`` package.
136
137`June 2012
138<https://github.com/praw-dev/praw/commit/adaf89fe8631f41ab9913b379de104c9ef6a1e73>`_:
139Bryce renamed the project ``PRAW`` and the repository was relocated to the
140newly created praw-dev organization on GitHub.
141
142`February 2016
143<https://github.com/praw-dev/praw/commit/252083ef1dbfe6ea53c2dc99ac235b4ba330b658>`_:
144Bryce began work on PRAW4, a complete rewrite of PRAW.
145
146
147License
148-------
149
150PRAW's source (v4.0.0+) is provided under the `Simplified BSD License
151<https://github.com/praw-dev/praw/blob/0860c11a9309c80621c267af7caeb6a993933744/LICENSE.txt>`_.
152
153* Copyright (c), 2016, Bryce Boe
154
155Earlier versions of PRAW were released under `GPLv3
156<https://github.com/praw-dev/praw/blob/0c88697fdc26e75f87b68e2feb11e101e90ce215/COPYING>`_.
157