This test is designed to help you showcase your back end engineering skills. The primary objective is to interact with a given API to retrieve, filter, transform, and post outages data for a specific site.
This repository is an alternative attempt to the KrakenFlex Back End Test using python instead of javascript. (The original attempt can be found here)
This was not a requirement of the test, but I wanted to demonstrate my ability to work with multiple languages. This is also a good opportunity to compare the two languages and their respective ecosystems although this project still has it's TODO's
- All outages are retrieved from the
GET /outages
endpoint. - Information is retrieved from the
GET /site-info/{siteId}
endpoint for the site with the IDnorwich-pear-tree
. - Outages that began before
2022-01-01T00:00:00.000Z
or don't have an ID present in the list of devices in the site information are filtered out. - For the remaining outages, the display name of the device from the site information is attached to each appropriate outage.
- This list of outages is sent to
POST /site-outages/{siteId}
for the site with the IDnorwich-pear-tree
.
Additionally, the solution is resilient to occasional 500 error responses from the API (I upped the retries to 5).
- Clone this repository to your local machine.
- Navigate to the project directory.
- Set up a virtual environment of your choosing
- Install the necessary Python packages using the command:
pip install -r requirements.txt
- Run the program using the command:
python main.py
Unit tests have been outlined in test_main.py
. To execute the tests:
- Navigate to the project directory.
- Run the tests using the command:
python -m unittest test_main.py
- etc...
🐙🐙🐙💪💪💪