Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/santoshvarmaaddala/leetcode_api
Leetcode Api for fetch the leetcode user details easily
https://github.com/santoshvarmaaddala/leetcode_api
api endpoint fastapi graphql leetcode python3 request uvicorn webscarpping
Last synced: 16 days ago
JSON representation
Leetcode Api for fetch the leetcode user details easily
- Host: GitHub
- URL: https://github.com/santoshvarmaaddala/leetcode_api
- Owner: santoshvarmaaddala
- License: mit
- Created: 2024-07-16T13:47:18.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-16T16:10:18.000Z (6 months ago)
- Last Synced: 2024-07-17T19:40:27.685Z (6 months ago)
- Topics: api, endpoint, fastapi, graphql, leetcode, python3, request, uvicorn, webscarpping
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LeetCode API with FastAPI
This project provides a FastAPI-based API to fetch user details from LeetCode, including their global ranking and total problems solved.
## Features
- Fetch LeetCode user profile details.
- Fetch the global ranking of a LeetCode user.
- Fetch the total number of problems solved by a LeetCode user, categorized by difficulty.## Endpoints
### Get User Profile
- **URL**: `/leetcode/{username}`
- **Method**: `GET`
- **Description**: Fetches the complete profile details of a LeetCode user.
- **Response**:
```json
{
"username": "user123",
"profile": {
"realName": "User Name",
"aboutMe": "About the user",
"school": "User's School",
"websites": ["website1", "website2"],
"countryName": "Country",
"company": "User's Company",
"ranking": 12345
},
"submitStats": {
"acSubmissionNum": [
{
"difficulty": "All",
"count": 100,
"submissions": 150
},
]
}
}# Installation
### 1.Clone the repository:
```sh
git clone https://github.com/yourusername/leetcode-api.git
cd leetcode-api
```
### 2.Create a virtual environment and activate it:
```sh
python -m venv .venv
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
```
### 3.Install the dependencies:
```sh
pip install -r requirements.txt
```
### 4.Run the FastAPI app:
```sh
uvicorn main:app --reload
```
### 5.Access the API documentation at:
http://localhost:8000/docs
or
http://localhost:8000/redoc## Dependencies
FastAPI
requests
uvicorn
## License
This project is licensed under the MIT License. See the LICENSE file for details.