Skip to content
Built as part of the SpotHero interview process, this is a simple Python (Flask) API that returns the rate of a given time range.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api Initial commit Jun 25, 2019
db-data Initial commit Jun 25, 2019
tests Initial commit Jun 25, 2019
.dockerignore Initial commit Jun 25, 2019
.gitignore Initial commit Jun 25, 2019
Dockerfile Initial commit Jun 25, 2019
README.md Initial commit Jun 25, 2019
docker-compose.yml Initial commit Jun 25, 2019
mypy.ini Initial commit Jun 25, 2019
package.json Initial commit Jun 25, 2019
requirements.txt Initial commit Jun 25, 2019

README.md

@flesch/spothero-code-challenge

Built as part of the SpotHero interview process, this is a simple Python (Flask) API that returns the rate of a given time range.

Assuming you have Docker installed, simply run the following to spin up the server:

$ docker-compose up --build

Rate data is pre-defined in a JSON file. By default, the app will load db-data/rates.json on start-up, however you're able to change this behavior by updating the JSON_DATA_FILE environmental variable to point to an alternate file.

$ JSON_DATA_FILE=db-data/rates.json docker-compose up --build

To discover a time range's rate, issue a POST request to /api/rates, like the following:

curl --silent \
     --data '{"start":"2015-07-01T07:00:00-05:00", "end":"2015-07-01T12:00:00-05:00"}' \
     --header "Content-Type: application/json" \
     --request POST http://localhost:4823/api/rates

See tests/test.sh for additional examples.

You can’t perform that action at this time.