This project demonstrates how to integrate Amadeus APIs using the Python SDK in a Django application.
In this scenario, the end user submits round-trip information via a form and the Trip Purpose Prediction API is called. This API predicts if a the given journey is for leisure or business purposes.
You can refer to this blog article which goes through the implementation step by step.
Clone the repository.
git clone https://github.com/amadeus4dev/amadeus-trip-purpose-django.git
cd amadeus-trip-purpose-django
Next create a virtual environment and install the dependencies.
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
For authentication add your API key/secret to your environmental variables.
export AMADEUS_CLIENT_ID=YOUR_API_KEY
export AMADEUS_CLIENT_SECRET=YOUR_API_SECRET
You can easily switch between test
and production
environments by setting:
export AMADEUS_HOSTNAME="test" # an empty value will also set the environment to test
or
export AMADEUS_HOSTNAME="production"
Each environment has different API keys. Do not forget to update them!
Finally, run the Django server.
python prediction/manage.py runserver
Finally, open a browser and go to https://127.0.0.1:8000
This library is released under the MIT License.
You can find us on StackOverflow or join our developer community on Discord.