Skip to main content

Prerequisites

  1. Create or sign in to a Reddit account at reddit.com.
  2. Create a script app at reddit.com/prefs/apps.
  3. Copy the app’s client ID and client secret.
RedditTools can perform read-only operations with the client ID and client secret. Set a username and password only for write operations.

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export required credentials

4

Set optional Reddit credentials

REDDIT_USER_AGENT overrides the default user agent. Set REDDIT_USERNAME and REDDIT_PASSWORD for write operations.
5

Run the example

Save the code above as reddit_tools.py, then run:
Full source: cookbook/91_tools/reddit_tools.py