Welcome to Amadeus Python Library’s documentation!¶
Contents:
Amadeus Python Library¶
Python Package for Amadeus Travel Innovation Sandbox
- Free software: BSD license
- Amadeus Travel Innovation Sandbox Documentation: https://sandbox.amadeus.com/apis
- Python Package Documentation: https://amadeus.readthedocs.org.
Disclaimer¶
Amadeus is a trademark registered by Amadeus IT Group. The Python Library is created and maintained by Ardy Dedase and is not associated with nor endorsed by Amadeus. Therefore Amadeus has no responsibilities or liabilities in relation to the use of this code.
Background¶
After participating in a startup event sponsored by Amadeus, I realized that the code I started will be helpful to those who will use Amadeus’ Sandbox API in the future. So I decided to make it available as a Python package and share it on Github.
Features¶
- :airplane:: Flight Inspiration Search allows you to answer the question: Where can I go within a given travel budget?
- :airplane:: Extensive Flight Search allows you to answer the question: When is the best date to fly?
- :airplane:: Low-Fare Search lets you find the cheapest one way or return itineraries.
- :hotel:: Hotel Lowest Price Search by center point/radius and by latitude/longitude window.
- :car:: Car Rental Availability Search by center point/radius and by airport.
- :train:: Trains & Rail supports Rail station auto-complete and information.
- :factory:: CO2 Emissions Data average per passenger by origin and destination.
- :white_check_mark:: Tested on Python 2.6, 2.7, 3.3 and 3.4 for this release.
Installation¶
At the command line:
$ pip install amadeus
Or:
$ easy_install amadeus
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv amadeus
$ pip install amadeus
Usage¶
Before anything else, make sure that you have created an account and have gotten your API key from Amadeus: https://sandbox.amadeus.com/
Read the docs: http://amadeus.readthedocs.org/en/latest/usage.html
Or
Read the code: amadeus/amadeus.py and tests/test_amadeus.py
Installation¶
At the command line:
$ pip install amadeus
Or:
$ easy_install amadeus
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv amadeus
$ pip install amadeus
Usage¶
To use Amadeus Python Library in a project:
import amadeus
Flights¶
https://sandbox.amadeus.com/apis#flights
Flight Inspiration Search API:
from amadeus import Flights
flights = Flights('<Your API Key>')
resp = flights.inspiration_search(
origin='BKK',
departure_date="2015-11-25--2015-11-30",
max_price=200)
Extensive Flight Search API:
from amadeus import Flights
flights = Flights('<Your API Key>')
resp = flights.extensive_search(
origin='NCE',
destination='LAS',
departure_date='2015-11-25--2015-11-30',
duration='4--10')
Low Fare Search API:
from amadeus import Flights
flights = Flights('<Your API Key>')
resp = flights.low_fare_search(
origin='NCE',
destination='LAS',
departure_date='2015-11-25',
return_date='2015-11-30',
duration='4--10')
Airport Autocomplete:
from amadeus import Flights
flights = Flights('<Your API Key>')
resp = flights.auto_complete(term='Ban')
print(resp)
Hotel Lowest Price Search¶
https://sandbox.amadeus.com/apis#hotels
Search center point and radius:
from amadeus import Hotels
hotels = Hotels('<Your API Key>')
resp = hotels.search_circle(
check_in='2015-11-25',
check_out='2015-11-30',
latitude=16.44671,
longitude=102.833,
currency='USD',
max_rate=100,
radius=300)
Search by latitude/longitude window:
from amadeus import Hotels
hotels = Hotels('<Your API Key>')
resp = hotels.search_airport(
check_in='2015-11-25',
check_out='2015-11-30',
location='BKK',
currency='USD',
max_rate=100)
Car Rental Availability Search¶
https://sandbox.amadeus.com/content/cars
Search by airport:
from amadeus import Cars
cars = Cars('<Your API Key>')
resp = cars.search_airport(
pick_up='2015-11-25',
drop_off='2015-11-30',
location='BKK',
currency='USD',
lang='EN')
Search center point and radius:
from amadeus import Cars
cars = Cars('<Your API Key>')
resp = cars.search_circle(
pick_up='2015-11-25',
drop_off='2015-11-30',
latitude=16.44671,
longitude=102.833,
radius=70,
currency='USD',
lang='EN')
Rail and Train¶
Rail Station Auto Complete:
from amadeus import RailStations
rails = RailStations('<Your API Key>')
resp = rails.auto_complete(term='VENT')
Rail Station Get info:
from amadeus import RailStations
rails = RailStations('<Your API Key>')
resp = rails.get_info(id=8301700)
CO2 Emissions¶
https://sandbox.amadeus.com/content/CO2
Get emissions data:
from amadeus import CO2Emissions
co2 = CO2Emissions('<Your API Key>')
resp = co2.get_data(
origin='PAR',
destination='NYC')
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/ardydedase/amadeus/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
Amadeus Python Library could always use more documentation, whether as part of the official Amadeus Python Library docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/ardydedase/amadeus/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up amadeus for local development.
Fork the amadeus repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/amadeus.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv amadeus $ cd amadeus/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 amadeus tests $ python setup.py test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check https://travis-ci.org/ardydedase/amadeus/pull_requests and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Ardy Dedase <ardy.dedase@gmail.com>
Contributors¶
None yet. Why not be the first?
History¶
0.1.0 (2015-08-03)¶
- First release on PyPI.