Skip to content

Commit bf3b58c

Browse files
committed
add travel recommendations support
1 parent b28d31f commit bf3b58c

5 files changed

Lines changed: 43 additions & 1 deletion

File tree

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ List of supported endpoints
310310
# Get the result of the process by jobId
311311
amadeus.travel.trip_parser_jobs.result(response.data['id']).get()
312312
313+
# Travel Recommendations
314+
amadeus.reference_data.recommended_locations.get(cityCodes='PAR', travelerCountryCode='FR')
315+
313316
Development & Contributing
314317
--------------------------
315318

amadeus/namespaces/_reference_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from amadeus.reference_data._location import Location
44
from amadeus.reference_data._locations import Locations
55
from amadeus.reference_data._airlines import Airlines
6+
from amadeus.reference_data._recommended_locations import RecommendedLocations
67

78

89
class ReferenceData(Decorator, object):
@@ -11,6 +12,7 @@ def __init__(self, client):
1112
self.urls = Urls(client)
1213
self.locations = Locations(client)
1314
self.airlines = Airlines(client)
15+
self.recommended_locations = RecommendedLocations(client)
1416

1517
def location(self, location_id):
1618
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,5 +1,6 @@
11
from ._location import Location
22
from ._locations import Locations
33
from ._airlines import Airlines
4+
from ._recommended_locations import RecommendedLocations
45

5-
__all__ = ['Location', 'Locations', 'Airlines']
6+
__all__ = ['Location', 'Locations', 'Airlines', 'RecommendedLocations']
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from amadeus.client.decorator import Decorator
2+
3+
4+
class RecommendedLocations(Decorator, object):
5+
def __init__(self, client):
6+
Decorator.__init__(self, client)
7+
8+
def get(self, **params):
9+
'''
10+
Returns a list of destination recommendations
11+
12+
.. code-block:: python
13+
14+
15+
client.reference_data.recommended_locations.get(
16+
cityCodes='PAR'
17+
travelerCountryCode='FR'
18+
)
19+
20+
:param cityCodes: city used by the algorithm to recommend new destinations
21+
For example: ``PAR``
22+
:param travelerCountryCode: origin country following IATA standard
23+
For example: ``FR``
24+
25+
:rtype: amadeus.Response
26+
:raises amadeus.ResponseError: if the request could not be completed
27+
'''
28+
return self.client.get(
29+
'/v1/reference-data/recommended-locations', **params)

specs/namespaces/namespaces_spec.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
).not_to(be_none)
8787
expect(client.reference_data.locations.point_of_interest(
8888
'9CB40CB5D0').get).not_to(be_none)
89+
expect(client.reference_data.recommended_locations.get).not_to(be_none)
8990

9091
expect(client.travel.analytics.air_traffic.traveled.get).not_to(be_none)
9192
expect(client.travel.analytics.air_traffic.booked.get).not_to(be_none)
@@ -186,6 +187,12 @@
186187
'/v1/reference-data/locations/pois/XXX', a='b'
187188
))
188189

190+
with it('.reference_data.recommended_locations.get'):
191+
self.client.reference_data.recommended_locations.get(a='b')
192+
expect(self.client.get).to(have_been_called_with(
193+
'/v1/reference-data/recommended-locations', a='b'
194+
))
195+
189196
with it('.travel.analytics.air_traffic.traveled.get'):
190197
self.client.travel.analytics.air_traffic.traveled.get(a='b')
191198
expect(self.client.get).to(have_been_called_with(

0 commit comments

Comments
 (0)