https://github.com/amadeus4dev-examples/amadeus-trip-purpose-django
Python/Django application demonstrating the Trip-Purpose Prediction API
https://github.com/amadeus4dev-examples/amadeus-trip-purpose-django
amadeus amadeus-api demo django example prototype python
Last synced: 10 days ago
JSON representation
Python/Django application demonstrating the Trip-Purpose Prediction API
- Host: GitHub
- URL: https://github.com/amadeus4dev-examples/amadeus-trip-purpose-django
- Owner: amadeus4dev-examples
- License: mit
- Created: 2020-03-24T15:34:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T09:55:26.000Z (almost 2 years ago)
- Last Synced: 2024-04-22T11:01:36.957Z (almost 2 years ago)
- Topics: amadeus, amadeus-api, demo, django, example, prototype, python
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This project demonstrates how to integrate Amadeus APIs using the [Python SDK](https://github.com/amadeus4dev/amadeus-python) in a Django application.
In this scenario, the end user submits round-trip information via a form and the [Trip Purpose Prediction API](https://developers.amadeus.com/self-service/category/trip/api-doc/trip-purpose-prediction) is called. This API predicts if a the given journey is for leisure or business purposes.
You can refer to this [blog article](https://developers.amadeus.com/blog/amadues-api-django-python-sdk) which goes through the implementation step by step.
## How to run the project locally
Clone the repository.
```sh
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.
```sh
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
```
For authentication add your API key/secret to your environmental variables.
```sh
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.
```sh
python prediction/manage.py runserver
```
Finally, open a browser and go to `https://127.0.0.1:8000`
## License
This library is released under the [MIT License](LICENSE).
## Help
You can find us on [StackOverflow](https://stackoverflow.com/questions/tagged/amadeus) or join our developer community on
[Discord](https://discord.gg/cVrFBqx).