We will walk through the API documentation and see what we can do with it and how we make a Reddit bot. Python provides a parser module for handling the Reddit API called Praw. First, install the python latest version if you don’t have one then you need Reddit API for it. Go to this URL  https://www.reddit.com/prefs/apps/ and select Create App

Image for post

Give it a name. You have to choose a redirect URI (for some stupid reason, stupid because I’m building a bot, not a web app, but whatever). I chose http://127.0.0.1 You will now get a client_id (red box below) and a secret (blue box below). Note it down, but keep it secret. Finally, install the below module in python, just copy the below command and paste it in your command prompt, the python Pip module will download and install it for you.

pip install praw

Coding

Create a py file with any name, and open it in the code editor. In the first step, we will initialize the authentication details of my Reddit account.

#python #api #reddit #bots

How to Create a Reddit bot using Python
33.55 GEEK