Skip to content

Commit 71781b6

Browse files
authored
Merge pull request #22 from amadeus4dev/doc_update_25oct2018
Update authentication documentation and examples
2 parents c7766a8 + 017d4eb commit 71781b6

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

README.rst

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ application.
3939
from amadeus import Client, ResponseError
4040
4141
amadeus = Client(
42-
client_id='[YOUR_CLIENT_ID]',
43-
client_secret='[YOUR_CLIENT_SECRET]'
42+
client_id='REPLACE_BY_YOUR_API_KEY',
43+
client_secret='REPLACE_BY_YOUR_API_SECRET'
4444
)
4545
4646
try:
47-
response = amadeus.reference_data.urls.checkin_links.get(airline='1X')
47+
response = amadeus.reference_data.urls.checkin_links.get(airline='BA')
4848
print(response.data)
49-
# => [{'type': 'checkin-link', 'id': '1XEN-GBWeb', 'href': 'https://www....
5049
except ResponseError as error:
5150
print(error)
5251
@@ -59,9 +58,9 @@ The client can be initialized directly.
5958
.. code:: py
6059
6160
# Initialize using parameters
62-
amadeus = Client(client_id='...', client_secret='...')
61+
amadeus = Client(client_id='REPLACE_BY_YOUR_API_KEY', client_secret='REPLACE_BY_YOUR_API_SECRET')
6362
64-
Alternatively it can be initialized without any paramters if the
63+
Alternatively it can be initialized without any parameters if the
6564
environment variables ``AMADEUS_CLIENT_ID`` and
6665
``AMADEUS_CLIENT_SECRET`` are present.
6766

@@ -100,12 +99,12 @@ Making API calls
10099

101100
This library conveniently maps every API path to a similar path.
102101

103-
For example, ``GET /v2/reference-data/urls/checkin-links?airline=1X``
102+
For example, ``GET /v2/reference-data/urls/checkin-links?airline=BA``
104103
would be:
105104

106105
.. code:: py
107106
108-
amadeus.reference_data.urls.checkin_links.get(airline='1X')
107+
amadeus.reference_data.urls.checkin_links.get(airline='BA')
109108
110109
Similarly, to select a resource by ID, you can pass in the ID to the
111110
singular path.
@@ -121,7 +120,7 @@ method:
121120

122121
.. code:: py
123122
124-
amadeus.get('/v2/reference-data/urls/checkin-links', airline='1X')
123+
amadeus.get('/v2/reference-data/urls/checkin-links', airline='BA')
125124
126125
Response
127126
--------
@@ -130,7 +129,7 @@ Every API call returns a ``Response`` object. If the API call contained
130129
a JSON response it will parse the JSON into the ``.result`` attribute.
131130
If this data also contains a ``data`` key, it will make that available
132131
as the ``.data`` attribute. The raw body of the response is always
133-
avaulable as the ``.body`` attribute.
132+
available as the ``.body`` attribute.
134133

135134
.. code:: py
136135
@@ -141,8 +140,8 @@ avaulable as the ``.body`` attribute.
141140
subType=Location.ANY
142141
)
143142
144-
print(reponse.body) #=> The raw response, as a string
145-
print(reponse.result) #=> The body parsed as JSON, if the result was parsable
143+
print(response.body) #=> The raw response, as a string
144+
print(response.result) #=> The body parsed as JSON, if the result was parsable
146145
print(response.data) #=> The list of locations, extracted from the JSON
147146
148147
Pagination
@@ -177,8 +176,8 @@ The SDK makes it easy to add your own logger.
177176
logger.setLevel(logging.DEBUG)
178177
179178
amadeus = Client(
180-
client_id='...',
181-
client_secret='...',
179+
client_id='REPLACE_BY_YOUR_API_KEY',
180+
client_secret='REPLACE_BY_YOUR_API_SECRET',
182181
logger=logger
183182
)
184183
@@ -190,55 +189,54 @@ enable debugging via a parameter on initialization, or using the
190189
.. code:: py
191190
192191
amadeus = Client(
193-
client_id='...',
194-
client_secret='...',
192+
client_id='REPLACE_BY_YOUR_API_KEY',
193+
client_secret='REPLACE_BY_YOUR_API_SECRET',
195194
log_level='debug'
196195
)
197196
198197
List of supported endpoints
199198
---------------------------
200199

201200
.. code:: py
202-
203-
# Airpot and City Search
204-
# Find all the cities and airportes starting by 'LON'
205-
amadeus.reference_data.locations.get(keyword='LON', subType=Location.ANY)
206-
# Get a specific city or airport based on its id
207-
amadeus.reference_data.location('ALHR').get()
208-
209-
# Aiport Nearest Relevant Airport
210-
amadeus.reference_data.locations.airports.get(longitude=49.000, latitude=2.55)
201+
# Flight Inspiration Search
202+
amadeus.shopping.flight_destinations.get(origin='MAD')
211203
212204
# Flight Cheapest Date Search
213205
amadeus.shopping.flight_dates.get(origin='NYC', destination='MAD')
214206
207+
# Flight Low-fare Search
208+
amadeus.shopping.flight_offers.get(origin='MAD', destination='NYC', departureDate='2019-08-01')
209+
215210
# Flight Checkin Links
216-
amadeus.reference_data.urls.checkin_links.get(airline='LH')
211+
amadeus.reference_data.urls.checkin_links.get(airline='BA')
217212
218213
# Airline Code Lookup
219-
amadeus.reference_data.airlines.get(IATACode='BA')
214+
amadeus.reference_data.airlines.get(IATACode='U2')
220215
221-
# Flight Inspiration Search
222-
amadeus.shopping.flight_destinations.get(origin='MAD')
216+
# Airport and City Search (autocomplete)
217+
# Find all the cities and airports starting by 'LON'
218+
amadeus.reference_data.locations.get(keyword='LON', subType=Location.ANY)
219+
# Get a specific city or airport based on its id
220+
amadeus.reference_data.location('ALHR').get()
223221
224-
# Flight Low-fare Search
225-
amadeus.shopping.flight_offers.get(origin='MAD', destination='NYC', departureDate='2019-08-01')
222+
# Airport Nearest Relevant Airport
223+
amadeus.reference_data.locations.airports.get(longitude=49.000, latitude=2.55)
226224
227225
# Flight Most Searched Destinations
228-
amadeus.travel.analytics.fare_searches.get(origin='NCE', sourceCountry='FR', period='2017-08')
226+
amadeus.travel.analytics.fare_searches.get(origin='MAD', sourceCountry='SP', period='2017-08')
229227
230228
# Flight Most Booked Destinations
231229
amadeus.travel.analytics.air_traffic.booked.get(origin='MAD', period='2017-08')
232230
233231
# Flight Most Traveled Destinations
234-
amadeus.travel.analytics.air_traffic.traveled.get(origin='NCE', period='2017-08')
232+
amadeus.travel.analytics.air_traffic.traveled.get(origin='MAD', period='2017-01')
235233
236234
# Flight Busiest Travel Period
237235
amadeus.travel.analytics.air_traffic.busiest_period.get(origin='MAD', period='2017', direction='ARRIVING')
238236
239237
# Hotel Search API
240-
# List of Hotels by City Code
241-
amadeus.shopping.hotel_offers.get(cityCode = 'PAR')
238+
# Get list of Hotels by city code
239+
amadeus.shopping.hotel_offers.get(cityCode = 'MAD')
242240
# Get list of offers for a specific Hotel
243241
amadeus.shopping.hotel('SMPARCOL').hotel_offers.get()
244242
# Confirm the availability of a specific offer for a specific Hotel

0 commit comments

Comments
 (0)