예제 #1
0
        flightDict["flightEnd"] = newObj.get("offerItems")[0].get("services")[0].get("segments")[
            0].get("flightSegment").get("arrival").get("iataCode")
        flightDict["flightCarrierCode"] = newObj.get("offerItems")[0].get("services")[0].get("segments")[
            0].get("flightSegment").get("carrierCode")
        fair = newObj.get("offerItems")[0].get("pricePerAdult").get("total")
        tax = newObj.get("offerItems")[0].get("pricePerAdult").get("totalTaxes")
        flightDict["totalFare"] = float(fair) + float(tax)
        flightList.append(flightDict)
        print(flights.data)
    except ResponseError as error:
        print(error)


# hotel information
try:
    hotels = amadeus.get('/v2/shopping/hotel-offers', cityCode=dest,
                         radius=hotelRadius, radiusUnit=radUnit)
    hotelList = []
    for newObj in hotels.data:
        hotelDict = {}
        hotelDict["name"] = newObj.get("hotel").get("name")
        if not newObj.get("hotel").get("description"):
            hotelDict["description"] = "NA"
        else:
            hotelDict["description"] = newObj.get("hotel").get("description").get("text")
        hotelDict["price"] = newObj.get("offers")[0].get("price").get("total")
        hotelList.append(hotelDict)
    print(hotelList)

except ResponseError as error:
    print(error)
예제 #2
0
from amadeus import Client, ResponseError, Location

amadeus = Client(client_id='oG6iyYGg6Fs5rvaI2qwvxsW8VRfbEVAn',
                 client_secret='NNX4hiJfywq2P3Pp')

picture = amadeus.get('/v2/media/files/generated-photos', category='MOUNTAIN')

print(picture.data['attachmentUri'])