API to fetch your LeetCode profile stats
- Clone the repository
cd
to root folder- Create a virtual environment:
python3 -m venv {ENV_NAME}
- Activate the virtual environment:
- Windows:
.\{ENV_NAME}\Scripts\activate
- Unix:
source /{ENV_NAME}/bin/activate
- Windows:
- Install dependencies:
pip3 install -r requirements.txt
- Run dev server:
$ uvicorn main:app --reload --host 127.0.0.1 --port 8000
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [24808] using WatchFiles
INFO: Started server process [27200]
INFO: Waiting for application startup.
INFO: Application startup complete.
- Hit the endpoint to get stats:
http://127.0.0.1:8000/{USERNAME}
- URL:
https://leetcode-stats-api.onrender.com/<your_leetcode_username>
- Test with API Docs
- python3
import requests
response = requests.get('https://leetcode-stats-api.onrender.com/shadhin17')
stats = response.json()
print(stats['data'])
- js
fetch('https://leetcode-stats-api.onrender.com/shadhin17')
.then((response) => response.json())
.then((stats) => console.log(stats.data))
.catch((error) => console.error(error));
- curl
curl https://leetcode-stats-api.onrender.com/shadhin17