A Flask application that retrieves travel package data from Google Cloud Storage.
- Install dependencies:
pip install -r flask_app/requirements.txt-
Set up Google Cloud credentials:
- Create a service account in Google Cloud Console
- Download the service account key
- Place the key file in the
flask_appdirectory asservice-account-key.json - Ensure the service account has access to the Cloud Storage bucket
-
Environment Variables:
- Create a
.envfile in theflask_appdirectory - Add:
GOOGLE_APPLICATION_CREDENTIALS=./service-account-key.json
- Create a
- Build the image:
cd flask_app
docker build -t travel-api .- Run the container:
docker run -p 5000:5000 travel-apiGET /: Welcome message and API informationGET /packages: Get all travel packagesGET /packages/search: Search packages with filters- Query Parameters:
flight_number: Exact matchdeparture_airport,arrival_airport: Partial matchroom_type: Exact match (Single, Double, Suite)min_price,max_price: Price rangemin_departure_date,max_departure_date: Date range (M/D/YYYY)min_arrival_date,max_arrival_date: Date range (M/D/YYYY)min_check_in_date,max_check_in_date: Date range (M/D/YYYY)min_check_out_date,max_check_out_date: Date range (M/D/YYYY)
- Query Parameters:
- Never commit the
service-account-key.jsonfile to version control - Keep your Google Cloud credentials secure and share them through secure channels
- The
.envfile is also excluded from version control for security