/github-user-search-api

Django API scrapes users info based on search parameters

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Django CI Azure Web App

Github User Search API

A REST API made w/ Django which generates a csv formatted response of user information retrieved from given search query parameters as input.

Tech Stack

  • Python 3.10
  • Django 4.1.3

API Reference

Search users with given parameters

  GET /user/?keyword={}&location={}&followers={}&repos={}&language={}
Parameter Type Description
keyword string Name, Keyword in Bio of the user
location string Location of the user
followers string No. of followers of user | Ex: >10, <30
repos string No. of public repositories | Ex: >4, <60
language string Most used programming language by the user

Atleast one of the following parameters is Required for a successful request

API Endpoint

github-user-search-api.azurewebsites.net/user/

API Demo using Postman

Run in Postman

Result

Example Query: user/?keyword=hackathon&location=india&followers=>2&repos=>5&language=python

Result for the above query can be seen in the file user_info.csv

What's The Code ?

  • Processes input parameters (keyword, location etc. of user) to search users, then from the search result retrieves the user info(name, email etc.) of all users using the GitHub API.
  • Implemented multi-threading to make multiple http requests concurrently which increases the speed of the program significantly

Run Locally

Clone the project

  git clone https://github.com/rogdex24/github-user-search-api.git

Go to the project directory

  cd github-user-search-api

Create a virtual environment

  python -m venv .venv

Activate the virtual environment

  . .venv/Scripts/activate

Add the environment variables: (create the '.env' file and add the variables)

  GITHUB_PAT=<YourGithubPAT>

Install the dependencies:

  pip install -r requirements.txt

Create a superuser

  python manage.py createsuperuser

Migrate the databse

  python manage.py migrate

Run the Server

  python manage.py runserver