Gatekeeper
is a Python script for managing followers and following users on GitHub. The script allows you to list, follow, or unfollow users based on whether they follow you back or not. You can also define exceptions in the configuration file to exclude certain users from being included in these lists.
- List all your followers
- List all users you're following
- List users you're following but aren't following you back
- Unfollow users who aren't following you back
- List users following you but you're not following them back
- Follow users who are following you but you're not following back
- Supports user-defined exceptions for certain categories (crooks and niceys)
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/gatekeeper.git
-
Navigate into the project directory:
cd gatekeeper
-
Install the required dependencies:
pip install -r requirements.txt
-
Ensure you have created a
config.toml
file based on the providedexample.config.toml
.
You’ll need to configure the API_KEY
in the config.toml
file for the script to work with GitHub's API. You can use the provided example.config.toml
file as a template for creating your own config.toml
.
- Copy the
example.config.toml
file and rename it toconfig.toml
(it’s just a template). - Fill in your GitHub Personal Access Token for
API_KEY
and adjust thecrooks
andniceys
lists as needed.
Here's the structure you should follow:
[security]
API_KEY = "" # Replace with your GitHub API Key
[users.exceptions]
crooks = []
niceys = []
- The
API_KEY
field should be filled with your GitHub Personal Access Token. You can create one on GitHub here. - The
crooks
andniceys
fields are optional and can be used to maintain a list of users that fit these categories, which you can use in your program’s logic.
The crooks
and niceys
lists in the config.toml
file are used to manage exceptions when filtering your followers and followings:
-
Crooks: This list is used to exclude users you're following who aren't following you back. For example, the function
get_crooks_logins
calculates users you follow but removes those listed in thecrooks
exception list. -
Niceys: This list is used to exclude users who are following you but you aren't following them back. The function
get_niceys_logins
identifies such users and removes those listed in theniceys
exception list.
[security]
API_KEY = "your_github_api_key_here"
[users.exceptions]
crooks = ["user1", "user2"]
niceys = ["user3", "user4"]
In the above example:
- "user1" and "user2" are considered exceptions and won't be included in the list of "crooks."
- "user3" and "user4" are exceptions and won't be included in the list of "niceys."
After configuring the config.toml
file, you can run the script directly from the command line with different options.
usage: gatekeeper [-h] [-v] (--list_followers | --list_following | --list_crooks | --unfollow_crooks | --list_niceys | --follow_niceys)
Manage followers and following users on Github
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--list_followers List all your followers
--list_following List all users you're following
--list_crooks List all users you're following but aren't following you back
--unfollow_crooks Unfollow all users who aren't following you back
--list_niceys List all users that are following you but you aren't following them back
--follow_niceys Follow all users that you are following you but you aren't following them
-
List all followers:
python run.py --list_followers
-
List all users you're following:
python run.py --list_following
-
List all users you're following but aren't following you back:
python run.py --list_crooks
-
Unfollow all users who aren't following you back:
python run.py --unfollow_crooks
-
List all users following you but you aren't following them back:
python run.py --list_niceys
-
Follow all users that are following you but you aren't following them back:
python run.py --follow_niceys
This project is licensed under the MIT License - see the LICENSE file for details.