CSC/ECE 517 Spring 2024 - G2402 Implement REST client, REST API, and Graphql API endpoint for repositories
GitHub Miner
This is a convenient tool to query a user's GitHub metrics. The project aims to develop API endpoints for GitHub GraphQL queries and GitHub REST queries using Python Flask. It involves integrating existing code with Flask to expose GraphQL queries as API endpoints, developing a REST client, and creating REST endpoints for querying the same data sets. The project also includes thorough testing and documentation of the endpoints.
Live Demo & Source Code
http://152.7.177.239:5000/auth/login Link]
Installation
We recommend using virtual environment. Steps to setup virtual environment:
cd path/to/your/project/directory python -m venv venv
On macOS and Linux:
source venv/bin/activate
On Windows (Command Prompt):
.\venv\Scripts\activate
On Windows (PowerShell):
.\venv\Scripts\Activate.ps1
Next, install all the necessary libraries:
pip -r requirements.txt
Next, set the PYTHONPATH to
On Windows
set PYTHONPATH=%PYTHONPATH%;path/to/your/project set PYTHONPATH=%PYTHONPATH%;path/to/your/project/backend
On Unix or MacOS
export PYTHONPATH=$PYTHONPATH:/path/to/your/project export PYTHONPATH=%PYTHONPATH%;path/to/your/project/backend
You can run the app from your terminal by executing the following command:
python backend\run.py
GraphQL Active Endpoints
Get current user login:
/api/graphql/current-user-login
Output:
{ "viewer": { "login": "<your-username>" } }
Get specific user login:
/api/graphql/user-login/<username>
Get list of all commits in a repo:
/api/graphql/specific-user-commits/<owner>/<repo_name>
Get details of all contributors in a repo:
/api/graphql/repository-contributors/<owner>/<repo_name>
REST API Endpoints
Get current user login:
/api/rest/current-user-login-rest
Get list of all commits in a repo:
/api/rest/specific-user-commits/<owner>/<repo_name>
Output:
[ { "repository": { "defaultBranchRef": { "target": { "history": { "nodes": [ { "additions": 0, "author": { "email": "61797592+Atharva7007@users.noreply.github.com", "name": "Atharva Pansare", "user": { "login": "Atharva7007" } }, "authoredDate": "2020-04-03T09:30:17Z", "changedFilesIfAvailable": 1, "deletions": 0, "message": "Add files via upload", "parents": { "totalCount": 1 } } ], "pageInfo": { "endCursor": "98ba34a6c62ff6fe7c4d4de5c342a194f72d66e4 0", "hasNextPage": true }, "totalCount": 6 } } } } } ]
Get details of all contributors in a repo:
/api/rest/repository-contributors/<owner>/<repo_name>