Making a Reddit Bot Account#

In using this textbook, you will have opportunities to create and run reddit bots on your own reddit account.

While we have made a fake version of Reddit for you to test all the code in this book, we highly encourage you to make a reddit bot account and try it out for real!

Sign up for Reddit#

https://www.reddit.com/register/

You might want to make a new, separate Reddit account, just for making reddit bots, since you don’t want to accidentally get your main reddit account banned or labeled as a bot.

Note: If you want to make a new account and you already have one, you may need to sign out from your current account, or use a different web browser (e.g., Mozilla, Google Chrome, Microsoft Edge, Safari).

Create Reddit bot “application”#

Once you are logged into Reddit, go to user settings:

Screenshot of the user menu at the top right of the screen, with 'User Settings' highlighted.

In the user settings, go to the Safety & Privacy tab and click the Manage third-party app authorization link at the bottom. This should take you to an apps tab (you can also try going straight there with this link). Click on the bottom button that says “are you a developer? create an app…”

screenshot of the user settings (called 'preferences' on this page) with the apps tab selected. There is a list of auhtorized apps, with reddit on mobile web as the first one, and then a button at the bottom which we have highlighted called 'are you a developer? create an app...'

Once you are on the create application page, make up a name for your bot (I chose “class_testing_scripts”), then choose the “scripts” type, fill in a description, and for the redirect uri, use “http://www.example.com/unused/redirect/uri”

Screeshot of create application page with name as 'class_testing_scripts'; then type set to 'script' (instead of web app or installed app); then description filled out as 'This will be used to learn how to program with Reddit as part of a class'; then about url left blank, and redirect url as 'http://www.example.com/unused/redirect/uri'

Once you are done, you should see the app information, which includes two key values: the client_id and the client_secret. Copy these so that you can use them later to run your bot.

Screenshot of the app information. Under the name and description of the app is the client_id, which is a bunch of random numbers and letters (though I blocked it out in the screenshot). Below that is the 'secret', another set of random numbers and letters, which I blocked out as well.

Test your keys#

When you get to chapter 2.3.8 (Demo: Try Running the Reddit Bot!), you can try running the code and replacing the fake special passwords with the ones from your account, and see if you can use the code to post an actual tweet to your account.

Understand Reddit Rules for Bots#

Before you try doing anything too creative with reddit bots, make sure you look over the Reddit API Terms of Use and the Reddit API Rules, that way you don’t get yourself banned.