amadeus4dev / amadeus-python

Python library for the Amadeus Self-Service travel APIs
https://developers.amadeus.com
MIT License
195 stars 77 forks source link

Issue with search hotels by id #201

Closed abdulzain6 closed 8 months ago

abdulzain6 commented 1 year ago

Description

Iam trying to get hotels using the autocomplete api then iam using the hotel offers api to get offers. But when i try it shows an error. When i manually try using requests it says property not found.

Steps to Reproduce

from amadeus import Client, Hotel, Response amadeus = Client( client_id='id', client_secret='secret', hostname="production" ) data: Response = amadeus.reference_data.locations.hotel.get(keyword='PARI', subType=[Hotel.HOTEL_GDS, Hotel.HOTEL_LEISURE]) print(data.data) ids = data.data[0]["hotelIds"] print("ids", ids)

print(amadeus.reference_data.locations.hotels.by_hotels.get(hotelIds=ids)) #error print(amadeus.reference_data.locations.hotels.by_hotels.get(hotelIds=ids[0]))#error

Expected Behavior: I expect it to return the offers

Actual Behavior: [{'id': 19179576, 'name': 'PARI', 'iataCode': 'JGA', 'subType': 'HOTEL_LEISURE', 'relevance': 1000, 'type': 'location', 'hotelIds': ['TVJGAAAM', 'TEJGAAD8', 'HDJGAAEU', 'XDJGAAB8', 'ADJGA00M', 'BBJGAACG', 'ASJGA016', 'DKJGA03O'], 'address': {'cityName': 'DWARKA', 'countryCode': 'IN', 'stateCode': 'GJ'}, 'geoCode': {'latitude': 22.24027, 'longitude': 68.96437}}, {'id': 8104629, 'name': 'LA PARI PARI', 'iataCode': 'LGK', 'subType': 'HOTEL_LEISURE', 'relevance': 74, 'type': 'location', 'hotelIds': ['XDLGKCJQ', 'BBLGKAHO', 'DKLGKAFC', 'TELGKBDZ', 'ADLGKCIL', 'HDLGKBDF', 'ASLGKADS', 'HVLGKABY', 'SJLGKAF3', 'GCLGKAC7', 'VJLGK03K'], 'address': {'cityName': 'LANGKAWI', 'countryCode': 'MY'}, 'geoCode': {'latitude': 6.2796, 'longitude': 99.73411}}, {'id': 8388386, 'name': 'PARIS COMME CHEZ VOUS APPARTEMENT PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['TEPARORV'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.87524, 'longitude': 2.30387}}, {'id': 26357219, 'name': 'PARIS COMME CHEZ VOUS APPARTEMENT PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['HDPAR3NE'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.87524, 'longitude': 2.30387}}, {'id': 27624353, 'name': 'PARIDISE HOMESTAY PULAU PARI', 'iataCode': 'JKT', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['ASJKT4W6'], 'address': {'cityName': 'JAKARTA', 'countryCode': 'ID'}, 'geoCode': {'latitude': -5.85733, 'longitude': 106.62036}}, {'id': 28244603, 'name': 'PARIDISE HOMESTAY PULAU PARI', 'iataCode': 'JKT', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['HVJKT09I'], 'address': {'cityName': 'KEPULAUAN SERIBU', 'countryCode': 'ID'}, 'geoCode': {'latitude': -5.85975, 'longitude': 106.61656}}, {'id': 2635385, 'name': 'SOFITEL LE SCRIBE PARIS OPERA HOTEL PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['BBPARACB'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.87063, 'longitude': 2.33001}}, {'id': 11067883, 'name': 'S NATURE PARIS AT DISNEYLAND PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 73, 'type': 'location', 'hotelIds': ['BBPARAK4', 'ASPARCY5'], 'address': {'cityName': 'BAILLY-ROMAINVILLIERS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.83018, 'longitude': 2.82979}}, {'id': 26292620, 'name': 'HOME ST MICHEL JARDIN DU LUXEMBOURG PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['BKPAR0QK'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.84304, 'longitude': 2.33885}}, {'id': 6897011, 'name': 'OYO 514 OMAH PARI BOUTIQUE HOTEL', 'iataCode': 'JOG', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['ADJOGCIG', 'HDJOGBOA', 'TEJOGBUW', 'ASJOGAQE', 'SJJOGANT', 'BBJOGAB2', 'XDJOGAD0', 'TVJOGASF', 'HBJOG0W4', 'VJJOG09G', 'VJJOG0B5'], 'address': {'cityName': 'YOGYAKARTA', 'countryCode': 'ID'}, 'geoCode': {'latitude': -7.80509, 'longitude': 110.348}}, {'id': 14209294, 'name': 'LA QUINTA INN AND SUITES BY WYNDHAM PARI', 'iataCode': 'PRX', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['TVPRXAAP'], 'address': {'cityName': 'PARIS', 'countryCode': 'US', 'stateCode': 'TX'}, 'geoCode': {'latitude': 33.67423, 'longitude': -95.52167}}, {'id': 9776886, 'name': 'HOTEL DES ARCADES DE CACHAN GRAND PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['ASPARCKN', 'BKPARAXS'], 'address': {'cityName': 'CACHAN', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.7959, 'longitude': 2.33585}}, {'id': 19299906, 'name': 'THE ORIGINALS BOUTIQUE HOTEL GOLF PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['TVPARC1L'], 'address': {'cityName': 'ROSNY SOUS BOIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.8762, 'longitude': 2.47464}}, {'id': 1592028, 'name': 'THE ORIGINALS CITY HOTEL LECOURBE PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['HVPARASJ', 'SJPARALP', 'BBPARCGB', 'XDPARDIW', 'ADPARDIW', 'BKPARBO3', 'ASPARDAS', 'TVPARC5W', 'HBPAR04X', 'VJPAR1SU'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.84457, 'longitude': 2.30882}}, {'id': 18368888, 'name': 'OYO HOTEL PARI', 'iataCode': 'DEL', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['HDDELG47', 'ASDELF8E'], 'address': {'cityName': 'GREATER NOIDA', 'countryCode': 'IN', 'stateCode': 'DL'}, 'geoCode': {'latitude': 28.41966, 'longitude': 77.55432}}, {'id': 20975871, 'name': 'LAMZY PARI MAHAL', 'iataCode': 'SXR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['DKSXRAI5', 'BKSXR02X', 'DKSXR045', 'HDSXR05V'], 'address': {'cityName': 'SRINAGAR', 'countryCode': 'IN', 'stateCode': 'JK'}, 'geoCode': {'latitude': 34.13998, 'longitude': 74.87631}}, {'id': 24919451, 'name': 'PARI RESORT WITH NATURE VIEW', 'iataCode': 'KQH', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['DKKQH017', 'BKKQH019'], 'address': {'cityName': 'KISHANGARH', 'countryCode': 'IN', 'stateCode': 'RJ'}, 'geoCode': {'latitude': 26.47649, 'longitude': 74.54734}}, {'id': 26292639, 'name': 'COSY FLAT 4P SOUTH PIGALLE CENTER PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['BKPAR0UK'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.87724, 'longitude': 2.33919}}, {'id': 10693289, 'name': 'BINTANG PARI', 'iataCode': 'DPS', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['SJDPSDOA', 'ADDPSBVZ', 'BBDPSBYI'], 'address': {'cityName': 'UBUD', 'countryCode': 'ID'}, 'geoCode': {'latitude': -8.49041, 'longitude': 115.26508}}, {'id': 26292769, 'name': 'NICE AND MODERN 1BR AT THE HEART OF PARI', 'iataCode': 'PAR', 'subType': 'HOTEL_LEISURE', 'relevance': 70, 'type': 'location', 'hotelIds': ['BKPAR1QI'], 'address': {'cityName': 'PARIS', 'countryCode': 'FR'}, 'geoCode': {'latitude': 48.88303, 'longitude': 2.36631}}] ids ['TVJGAAAM', 'TEJGAAD8', 'HDJGAAEU', 'XDJGAAB8', 'ADJGA00M', 'BBJGAACG', 'ASJGA016', 'DKJGA03O'] response._detect_error(self) File "/home/zain/.local/lib/python3.11/site-packages/amadeus/mixins/parser.py", line 16, in _detect_error self.__raise_error(error, client) File "/home/zain/.local/lib/python3.11/site-packages/amadeus/mixins/parser.py", line 68, in __raise_error raise error amadeus.client.errors.ClientError: [400]

Stable Behavior? [What percentage of the time does it reproduce?] 100%

Versions

What version of Python/Pip are you running? What Operating System are you on? Linux python 3.11

Checklist

Please make sure you checked the following: