screen-recording-2023-06-03-at-100020-pm_kEZxkkvz.2.mov
Quick way to keep track of problems you solved on Notion by running a python script
Table of Contents
The LeetCode Notion Tracker is a Python script that allows you to easily track your progress in solving LeetCode questions by integrating with Notion, a popular productivity and note-taking tool. With this script, you can conveniently add LeetCode questions to your Notion database and keep track of the questions you have completed.
- Question Tracking: The script allows you to add LeetCode questions to your Notion database and update the status of completed questions.
- Automatic Data Retrieval: It retrieves question information from the LeetCode API, such as difficulty level and question title.
- Notion Integration: Utilizes the Notion API to create and update pages in your Notion database.
- Command-Line Interface: You can interact with the script through a command-line interface by providing the LeetCode question number as an argument.
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
This is an example of how to list things you need to use the software and how to install them.
- Python
Python 3.11
- EnvFile
pip install python-dotenv
- Notion
Read the Notion Docs on how to obtain a NOTION TOKEN
- Clone the repo
git clone https://github.com/chentze02/leetcode-notion-tracker.git
2.Setup your token and database id
-
Install the
python-dotenvpackage by runningpip install python-dotenvin your terminal. -
Create an environment file (e.g.,
.env) in the/usr/localdirectory and populate it with your sensitive information:
NOTION_TOKEN=YOUR_NOTION_TOKEN DATABASE_ID=YOUR DATABASE ID
Ensure that the environment file has the appropriate permissions set to protect the sensitive data.
- Update the script to load the environment variables from the file using
load_dotenv()function from thedotenvmodule. Provide the path to your environment file as an argument toload_dotenv().
Make sure to replace /usr/local/.env with the correct path to your environment
file.
Enter your DATABASE KEY and NOTION TOKEN in the MACROS
# TOKEN AND IDS
NOTION_TOKEN = "YOUR_NOTION_TOKEN"
DATABASE_ID = "YOUR_DATABASE_ID"To set up the LeetCode Notion Tracker script as a bash command, follow these steps:
-
Open a terminal.
-
Navigate to the directory where the script is located.
-
Rename the script file to
leetcodewithout the.pyextension.mv leetcode-tracker.py leetcode -
Make the script executable.
chmod +x leetcode -
Move the script to the
/usr/local/bindirectory.sudo mv leetcode /usr/local/bin/You will be prompted to enter your password for the sudo command.
-
Verify the installation by running the command
leetcode <leetcode_number>in the terminal. Replace<leetcode_number>with the actual LeetCode question number.
Now you can use the leetcode command as if it was a built-in bash command.
To add or update a LeetCode question in your Notion database, follow these steps:
- Open a terminal or command prompt.
- Navigate to the directory where the script is located.
- Run the script using the command
python your_script.py <leetcode_number>, replacing<leetcode_number>with the actual question number. - The script will fetch the question details from the LeetCode API and check if the question already exists in your Notion database.
- If the question exists, it will update the question's status with the current date and time.
- If the question does not exist, it will create a new entry in your Notion database with the question details and set the status to the current date and time.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Your Name - chentzen02@g.ucla.edu
Project Link: https://github.com/chentze02/leetcode-notion-tracker
This script is not affiliated with LeetCode or Notion. It is an independent tool developed to enhance the tracking of LeetCode question progress using Notion.