This application script will allow a Reddit user to create sets of subreddits they can subscribe to and provides them with an easy method of easily switching between their favorite sets to be displayed on their homepage
Pre-requisites - these are assumed to be already installed on your computer
- Required
- Python (minimum version: 3.6.7) - the language that this program was return in
- pip - the package installer for Python to install the necessary packages
- Recommended
- venv - virtual environment dedicated to run this application script so it doesn't pollute the global installation
In order to run the script, an application needs to be created under a Reddit account
If you do not have a Reddit account, first create one using this sign-up link
If you already have a Reddit account, simply login using this login-in link
Once you are logged in, go over to the Reddit applications link
If this you first Reddit application, you should see a button that reads "are you a developer? create an app...",
otherwise if this not you first outing, you should see a button that reads "create another app..."
Either way, click this button (which should be the last item on the page, under any other applications you own)
Next, you should see a form. Please follow the instructions there, including reading the API usage guidelines
The name can be anything you wish to name this application
The type of app should be selected to be "script"
You can choose to add a description and an about url, however they are not required
Even though this particular application script won't utilize a redirect uri, it is still required. Something
as simple as http://localhost:8080
should suffice
Finally, click the "create app" button in order to register a new application for this script
If you haven't already done so, clone this repository so you could obtain all the necessary files
Next, use the following command to install the necessary libraries for this script to work
pip install -r <path/to/requirements.txt>
, where <path/to/requirements.txt> is specifies the path where the
requirements.txt that was cloned from this repository is located
Next, within the cloned repository, locate the config.ini file. Here you will specify the credentials for your
application script to be run
Go back to the page from the last step, here you should find all the credentials you need to copy and paste into the
config.ini file after the "=" (equals) sign next to the config option's label. For a detailed explanation on what
these options mean, visit the relevant documentation
here
- The "client_id" is the string of characters located under "personal use script"
- The "client_secret" is the string of characters labelled by "secret"
- The "username" and "password" is the username and password of the Reddit account used to register this application
Note: if you are unable to locate these items, please carefully follow the steps listed under Registration
Finally, you are ready to run this Python program. To do so, open a terminal or command prompt, navigate to the folder
which contains the "scanner_bot.py" file and run the program using python3 scanner_bot.py
Note: if you have multiple python3 versions, you might need to specify the correct one using "python3.6" instead of "python3"
If you ever decide you want to stop the bot from running on your machine for a while, simply close the bot by providing a SIGINT to it. To do this, press CTRL + C on the terminal you are currently running it on or run kill with SIGINT on the correct process ID that represents it.