Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To run the project locally, clone the repository, and then create a virtual environment and install the dependencies.
```sh
git clone https://github.com/amadeus4dev/amadeus-python.git
cd amadeus-ruby
cd amadeus-python
```

First, ensure you have a version of every Python we support installed. Your versions may differ.
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
Changelog
=========

2.0.0 - 2018-10-14
--------------------

`Flight Most Searched Destinations <https://developers.amadeus.com/self-service/category/203/api-doc/6>`_: Redesign of the API - Split the previous endpoint in 2 endpoints:

- 1st endpoint to find the most searched destinations
- 2nd endpoint to have more data about a dedicated origin & destination

`Flight Most Booked Destinations <https://developers.amadeus.com/self-service/category/203/api-doc/27>`_:

- Rename origin to originCityCode

`Flight Most Traveled Destinations <https://developers.amadeus.com/self-service/category/203/api-doc/7>`_:

- Rename origin in originCityCode

`Flight Check-in Links <https://developers.amadeus.com/self-service/category/203/api-doc/8>`_:

- Rename airline to airlineCode

`Airport & City Search <https://developers.amadeus.com/self-service/category/203/api-doc/10>`_:

- Remove parameter onlyMajor

`Airport Nearest Relevant <https://developers.amadeus.com/self-service/category/203/api-doc/9>`_:

- Add radius as parameter

`Airline Code Lookup <https://developers.amadeus.com/self-service/category/203/api-doc/26>`_:

- Regroup parameters *IATACode* and *ICAOCode* under the same name *airlineCodes*

1.1.0 - 2018-08-01
--------------------

Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ List of supported endpoints
amadeus.shopping.flight_offers.get(origin='MAD', destination='NYC', departureDate='2019-08-01')

# Flight Checkin Links
amadeus.reference_data.urls.checkin_links.get(airline='BA')
amadeus.reference_data.urls.checkin_links.get(airlineCode='BA')

# Airline Code Lookup
amadeus.reference_data.airlines.get(IATACode='U2')
amadeus.reference_data.airlines.get(airlineCodes='U2')

# Airport and City Search (autocomplete)
# Find all the cities and airports starting by 'LON'
Expand All @@ -224,16 +224,16 @@ List of supported endpoints
amadeus.reference_data.locations.airports.get(longitude=49.000, latitude=2.55)

# Flight Most Searched Destinations
amadeus.travel.analytics.fare_searches.get(origin='MAD', sourceCountry='SP', period='2017-08')
amadeus.travel.analytics.fare_searches.get(originCityCode='MAD', sourceCountry='SP', period='2017-08')

# Flight Most Booked Destinations
amadeus.travel.analytics.air_traffic.booked.get(origin='MAD', period='2017-08')
amadeus.travel.analytics.air_traffic.booked.get(originCityCode='MAD', period='2017-08')

# Flight Most Traveled Destinations
amadeus.travel.analytics.air_traffic.traveled.get(origin='MAD', period='2017-01')
amadeus.travel.analytics.air_traffic.traveled.get(originCityCode='MAD', period='2017-01')

# Flight Busiest Travel Period
amadeus.travel.analytics.air_traffic.busiest_period.get(origin='MAD', period='2017', direction='ARRIVING')
amadeus.travel.analytics.air_traffic.busiest_period.get(cityCode='MAD', period='2017', direction='ARRIVING')

# Hotel Search API
# Get list of Hotels by city code
Expand Down
6 changes: 4 additions & 2 deletions amadeus/reference_data/_airlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ def get(self, **params):

.. code-block:: python

amadeus.reference_data.airlines.get(IATACode='U2')
amadeus.reference_data.airlines.get(airlineCodes='U2')

:param IATACode: the IATA code for the airline, e.g. ``"1X"``
:param airlineCodes: the IATA or ICAO code for the airline, e.g.
:``"AF"`` (Air France IATA code)
:or ``"AFR"`` (Air France ICAO code)

:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
Expand Down
4 changes: 2 additions & 2 deletions amadeus/reference_data/urls/_checkin_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def get(self, **params):

.. code-block:: python

amadeus.reference_data.urls.checkin_links.get(airline='1X')
amadeus.reference_data.urls.checkin_links.get(airlineCode='BA')

:param airline: the IATA code for the airline, e.g. ``"1X"``
:param airlineCode: the IATA code for the airline, e.g. ``"BA"``
:param language: the locale for the links, for example ``"en-GB"``

:rtype: amadeus.Response
Expand Down
2 changes: 0 additions & 2 deletions amadeus/travel/_analytics.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from amadeus.client.decorator import Decorator
from .analytics._air_traffic import AirTraffic
from .analytics._fare_searches import FareSearches


class Analytics(Decorator, object):
def __init__(self, client):
Decorator.__init__(self, client)
self.fare_searches = FareSearches(client)
self.air_traffic = AirTraffic(client)
3 changes: 1 addition & 2 deletions amadeus/travel/analytics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from ._fare_searches import FareSearches
from ._air_traffic import AirTraffic


__all__ = ['FareSearches', 'AirTraffic']
__all__ = ['AirTraffic']
4 changes: 4 additions & 0 deletions amadeus/travel/analytics/_air_traffic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from amadeus.client.decorator import Decorator
from .air_traffic._traveled import Traveled
from .air_traffic._booked import Booked
from .air_traffic._searched import Searched
from .air_traffic._searched_by_destination import SearchedByDestination
from .air_traffic._busiest_period import BusiestPeriod


Expand All @@ -9,4 +11,6 @@ def __init__(self, client):
Decorator.__init__(self, client)
self.booked = Booked(client)
self.traveled = Traveled(client)
self.searched = Searched(client)
self.searched_by_destination = SearchedByDestination(client)
self.busiest_period = BusiestPeriod(client)
33 changes: 0 additions & 33 deletions amadeus/travel/analytics/_fare_searches.py

This file was deleted.

5 changes: 4 additions & 1 deletion amadeus/travel/analytics/air_traffic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from ._traveled import Traveled
from ._searched import Searched
from ._searched_by_destination import SearchedByDestination
from ._booked import Booked
from ._busiest_period import BusiestPeriod


__all__ = ['Traveled', 'Booked', 'BusiestPeriod']
__all__ = ['Searched', 'SearchedByDestination',
'Traveled', 'Booked', 'BusiestPeriod']
4 changes: 2 additions & 2 deletions amadeus/travel/analytics/air_traffic/_booked.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def get(self, **params):
.. code-block:: python

amadeus.travel.analytics.air_traffic.booked.get(
origin='LHR',
originCityCode='LHR',
period='2017-01'
)

:param cityCode: IATA code of the origin city, for
:param originCityCode: IATA code of the origin city, for
example ``"BOS"`` for Boston.
:param query: period when consumers are traveling
in ``YYYY-MM`` format
Expand Down
6 changes: 4 additions & 2 deletions amadeus/travel/analytics/air_traffic/_busiest_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ def get(self, **params):
.. code-block:: python

amadeus.travel.analytics.air_traffic.busiest_period.get(
origin='MAD',
cityCode='MAD',
period='2017',
direction=Direction.ARRIVING
)

:param cityCode: IATA code of the origin city, for
example ``"BOS"`` for Boston.
:param query: period when consumers are traveling
:param period: period when consumers are traveling
in ``YYYY`` format
:param direction: to select between
arrivals and departures (default: arrivals)

:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
Expand Down
29 changes: 29 additions & 0 deletions amadeus/travel/analytics/air_traffic/_searched.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from amadeus.client.decorator import Decorator


class Searched(Decorator, object):
def get(self, **params):
'''
Returns a list of air traffic reports, based on number of searches.

.. code-block:: python

amadeus.travel.analytics.air_traffic.searched.get(
originCityCode='MAD',
searchPeriod='2017-08',
marketCountryCode='ES'
)

:param originCityCode: IATA code of the origin city, for
example ``"MAD"`` for Madrid.
:param searchPeriod: period when consumers are traveling
in ``YYYY-MM`` format
:param marketCountryCode: IATA code of the country from which
searches were made - e.g. ``"ES"`` for Spain


:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
'''
return self.client.get('/v1/travel/analytics/air-traffic/searched',
**params)
33 changes: 33 additions & 0 deletions amadeus/travel/analytics/air_traffic/_searched_by_destination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from amadeus.client.decorator import Decorator


class SearchedByDestination(Decorator, object):
def get(self, **params):
'''
The Flight Most Searched Destinations API allows to find the number of
estimated searches from an origin and a destination,
within a time period when travelers are performing the searches.

.. code-block:: python

amadeus.travel.analytics.air_traffic.searched_by_destination.get(
originCityCode='MAD',
destinationCityCode='NYC',
marketCountryCode='ES'
searchPeriod='2017-08'
)

:param originCityCode: IATA code of the origin city, for
example ``"MAD"`` for Madrid.
:param destinationCityCode: IATA code of the destination city, for
example ``"NYC"`` for New-York.
:param marketCountryCode: IATA code of the country from which
searches were made - e.g. ``"ES"`` for Spain
:param searchPeriod: period when consumers are traveling
in ``YYYY-MM`` format

:rtype: amadeus.Response
:raises amadeus.ResponseError: if the request could not be completed
'''
return self.client.get(
'/v1/travel/analytics/air-traffic/searched/by-destination', **params)
6 changes: 3 additions & 3 deletions amadeus/travel/analytics/air_traffic/_traveled.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def get(self, **params):
.. code-block:: python

amadeus.travel.analytics.air_traffic.traveled.get(
origin='LHR',
originCityCode='LHR',
period='2017-01'
)

:param cityCode: IATA code of the origin city, for
:param originCityCode: IATA code of the origin city, for
example ``"BOS"`` for Boston.
:param query: period when consumers are traveling
:param period: period when consumers are traveling
in ``YYYY-MM`` format

:rtype: amadeus.Response
Expand Down
2 changes: 1 addition & 1 deletion amadeus/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version_info = (1, 1, 0)
version_info = (2, 0, 0)
version = '.'.join(str(v) for v in version_info)
32 changes: 27 additions & 5 deletions specs/namespaces/namespaces_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
expect(client.travel).not_to(be_none)
expect(client.travel.analytics).not_to(be_none)
expect(client.travel.analytics.air_traffic.traveled).not_to(be_none)
expect(client.travel.analytics.fare_searches).not_to(be_none)
expect(client.travel.analytics.air_traffic.searched).not_to(be_none)
expect(client.travel.analytics.air_traffic.booked).not_to(be_none)
expect(
client.travel.analytics.air_traffic.searched_by_destination).not_to(
be_none)
expect(client.travel.analytics.air_traffic.busiest_period).not_to(be_none)

expect(client.shopping).not_to(be_none)
expect(client.shopping.flight_dates).not_to(be_none)
Expand All @@ -44,7 +49,15 @@
expect(client.reference_data.locations.airports.get).not_to(be_none)

expect(client.travel.analytics.air_traffic.traveled.get).not_to(be_none)
expect(client.travel.analytics.fare_searches.get).not_to(be_none)
expect(client.travel.analytics.air_traffic.booked.get).not_to(be_none)
expect(client.travel.analytics.air_traffic.searched.get).not_to(be_none)
expect(
client.travel.analytics.air_traffic.
searched_by_destination.get).not_to(
be_none)
expect(
client.travel.analytics.air_traffic.busiest_period.get).not_to(
be_none)

expect(client.shopping.flight_dates.get).not_to(be_none)
expect(client.shopping.flight_destinations.get).not_to(be_none)
Expand Down Expand Up @@ -106,12 +119,21 @@
'/v1/travel/analytics/air-traffic/busiest-period', a='b'
))

with it('.travel.analytics.fare_searches.get'):
self.client.travel.analytics.fare_searches.get(a='b')
with it('.travel.analytics.air_traffic.searched.get'):
self.client.travel.analytics.air_traffic.searched.get(a='b')
expect(self.client.get).to(have_been_called_with(
'/v1/travel/analytics/fare-searches', a='b'
'/v1/travel/analytics/air-traffic/searched', a='b'
))

with it('.travel.analytics.air_traffic.searched_by_destination.get'):
self.client.travel.analytics.air_traffic.searched_by_destination.get(
a='b')
expect(
self.client.get).to(
have_been_called_with(
'/v1/travel/analytics/air-traffic/searched/by-destination',
a='b'))

with it('.shopping.flight_dates.get'):
self.client.shopping.flight_dates.get(a='b')
expect(self.client.get).to(have_been_called_with(
Expand Down