This is an CLI, API and web application around Kiwi.com API to find best price per kilometer.
Navigate to backend
folder and run:
pip install --editable .
--editable option upgrades package on code change
-
Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.
-
Flask-CORS is the extension we'll use to handle cross origin requests from our frontend server.
-
Click is an package for creating beautiful command line interfaces.
To run and test the CLI, execute:
flight-optimizer --from <city> --to <city> [<city> ...]
where: --from specifies the departure city --to specifies a list of potential destination cities
To run web server, execute:
python3 webapp.py
- Fetches an object for city with minimum price
- Request Arguments: flightFrom, flightsTo
- Returns: An city object.
{
'id': 'london_gb',
'name': 'London',
'location': {'lon': -0.127758, 'lat': 51.507351},
'distance': 931.5659317961586,
'price': 44,
'price_per_km': 0.05
}
- Navigate to
backend
folder - Install node dependencies:
npm install
to upgrade the code:
npm run build
- Open a browser window and navigate to the index.html file
Depends on local environment you may want to change port number at RequestManager
constructor.