Skip to content

ZacksBot/GatewayAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing

Pytest

Testing Locally

pytest

Vulnerabilities API Gateway

This is a simple API gateway built using Flask. It fetches vulnerability data from the Silobreaker API converts it into a more readable gateway and and provides it in either CSV or JSON format.

Installation Without Docker

  1. Clone the repository:

    git clone https://github.com/ZacksBot/Gateway.git
    cd Gateway
  2. Create and Activate a Virtual Environmenty

    python3 -m venv myenv
    source myenv/bin/activate
    
  3. Install Dependencies

    pip install -r requirements.txt
    
  4. Run the Script

    python gateway.py
    

Installation With Docker

  1. Build the Docker image:

    docker build -t vulnerabilities-api-gateway .
  2. Run the Docker container:

    docker run -p 5000:5000 vulnerabilities-api-gateway

    This will start the API gateway on http://localhost:5000.

Usage

You can access the following endpoints:

  • CSV Format: http://localhost:5000/vulnerabilities
  • JSON Format: http://localhost:5000/vulnerabilities?format=json

Thought Process

Initial Approach

This task was quite simple. It required converting a lengthy URL, which was not optimal for developers, into a more accessible gateway endpoint called /vulnerabilities. Fetching the data from the long URL string and setting up the new endpoint was straightforward. The conversion to CSV was also simple; all I had to do was map through the JSON objects, extract specific values, and use the csv library to convert them into a CSV format.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published