Skip to content

Commit 3d7cbfe

Browse files
committed
added Flight Busiest Period, Flight Most Booked Destinations and Airline Lookup APIs
1 parent 90a383e commit 3d7cbfe

File tree

14 files changed

+122
-12
lines changed

14 files changed

+122
-12
lines changed

README.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ List of supported endpoints
215215
# Flight Checkin Links
216216
amadeus.reference_data.urls.checkin_links.get(airline='LH')
217217
218+
# Airline Code Lookup
219+
amadeus.reference_data.airlines.get(IATACode='BA')
220+
218221
# Flight Inspiration Search
219222
amadeus.shopping.flight_destinations.get(origin='MAD', maxPrice=200)
220223
@@ -224,9 +227,15 @@ List of supported endpoints
224227
# Flight Most Searched Destinations
225228
amadeus.travel.analytics.fare_searches.get(origin='NCE', sourceCountry='FR', period='2017-08')
226229
230+
# Flight Most Booked Destinations
231+
amadeus.travel.analytics.air_traffic.booked.get(origin='MAD', period='2017-08')
232+
227233
# Flight Most Traveled Destinations
228234
amadeus.travel.analytics.air_traffic.traveled.get(origin='NCE', period='2017-08')
229235
236+
# Flight Busiest Travel Period
237+
amadeus.travel.analytics.air_traffic.busiest_period.get(origin='NCE', period='2017-08')
238+
230239
# Hotel Search API
231240
# List of Hotels by City Code
232241
amadeus.shopping.hotel_offers.get(cityCode = 'PAR')

amadeus/namespaces/_reference_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
from amadeus.reference_data._urls import Urls
33
from amadeus.reference_data._location import Location
44
from amadeus.reference_data._locations import Locations
5+
from amadeus.reference_data._airlines import Airlines
56

67

78
class ReferenceData(Decorator, object):
89
def __init__(self, client):
910
Decorator.__init__(self, client)
1011
self.urls = Urls(client)
1112
self.locations = Locations(client)
13+
self.airlines = Airlines(client)
1214

1315
def location(self, location_id):
1416
return Location(self.client, location_id)

amadeus/reference_data/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ._location import Location
22
from ._locations import Locations
3+
from ._airlines import Airlines
34

4-
__all__ = ['Location', 'Locations']
5+
__all__ = ['Location', 'Locations', 'Airlines']
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class Airlines(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Returns the name of the airline given an IATA code.
8+
9+
.. code-block:: python
10+
11+
amadeus.reference_data.airlines.get(IATACode='U2')
12+
13+
:param IATACode: the IATA code for the airline, e.g. ``"1X"``
14+
15+
:rtype: amadeus.Response
16+
:raises amadeus.ResponseError: if the request could not be completed
17+
'''
18+
return self.client.get('/v1/reference-data/airlines', **params)

amadeus/reference_data/_location.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def get(self, **params):
1717
:rtype: amadeus.Response
1818
:raises amadeus.ResponseError: if the request could not be completed
1919
'''
20-
return self.client.get(
21-
'/v1/reference-data/locations/{0}'.format(self.location_id),
22-
**params
23-
)
20+
return self.client.get('/v1/reference-data/locations/{0}'
21+
.format(self.location_id), **params)
22+

amadeus/travel/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from ._analytics import Analytics
2+
3+
4+
__all__ = ['Analytics']
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from amadeus.client.decorator import Decorator
22
from .air_traffic._traveled import Traveled
3+
from .air_traffic._booked import Booked
4+
from .air_traffic._busiest_period import BusiestPeriod
35

46

57
class AirTraffic(Decorator, object):
68
def __init__(self, client):
79
Decorator.__init__(self, client)
10+
self.booked = Booked(client)
811
self.traveled = Traveled(client)
12+
self.busiest_period = BusiestPeriod(client)

amadeus/travel/analytics/_fare_searches.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@ def get(self, **params):
3030
:rtype: amadeus.Response
3131
:raises amadeus.ResponseError: if the request could not be completed
3232
'''
33-
return self.client.get(
34-
'/v1/travel/analytics/fare-searches', **params)
33+
return self.client.get('/v1/travel/analytics/fare-searches', **params)
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
from ._traveled import Traveled
2+
from ._booked import Booked
3+
from ._busiest_period import BusiestPeriod
24

3-
__all__ = ['Traveled']
5+
6+
__all__ = ['Traveled', 'Booked', 'BusiestPeriod']
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class Booked(Decorator, object):
5+
def get(self, **params):
6+
'''
7+
Returns a list of air traffic reports, based on bookings.
8+
9+
.. code-block:: python
10+
11+
amadeus.travel.analytics.air_traffic.booked.get(
12+
origin='LHR',
13+
period='2017-01'
14+
)
15+
16+
:param cityCode: IATA code of the origin city, for
17+
example ``"BOS"`` for Boston.
18+
:param query: period when consumers are traveling
19+
in ``YYYY-MM`` format
20+
21+
:rtype: amadeus.Response
22+
:raises amadeus.ResponseError: if the request could not be completed
23+
'''
24+
return self.client.get('/v1/travel/analytics/air-traffic/booked',
25+
**params)

0 commit comments

Comments
 (0)