コード例 #1
0
def test__v1_0_0_shop_hotels_description_post():
    client = get_client()

    j = json.loads('''{
                        "GetHotelDescriptiveInfoRQ": {
                            "HotelRefs": {
                                "HotelRef": [{
                                    "HotelCode": "11111"
                                }]
                            },
                            "DescriptiveInfoRef": {
                                "PropertyInfo": true,
                                "LocationInfo": true,
                                "Amenities": true,
                                "Descriptions": {
                                    "Description": [{
                                        "Type": "Dining"
                                    }]
                                },
                                "Airports": true,
                                "AcceptedCreditCards": true
                            }
                        }
                    }''')

    description = client.Hotel\
        .V1_0_0ShopHotelsDescriptionPost(gethoteldescriptionrequest=j,
                                         mode='description'
                                         )\
        .result()

    assert 29 == len(description['GetHotelDescriptiveInfoRS']
                     ['ApplicationResults']['Success'][0]['timeStamp'])
コード例 #2
0
def test__v1_lists_supported_countries_get():
    client = get_client()

    countries = client.Air_Utility.V1ListsSupportedPointofsalecountriesGet(
    ).result()
    # should be at least one entry with a string 2 characters long
    assert 2 == len(countries.Countries[0].CountryCode)
コード例 #3
0
def test__v1_0_0_shop_hotels_content_change_post():
    client = get_client()

    j = json.loads('''{

                      "GetHotelContentChangeRQ": {
                    
                        "ContentChangeRef": {
                    
                          "StartDate": "2015-05-18",
                    
                          "EndDate": "2015-05-23"
                    
                        }
                    
                      }
                    
                    }''')

    change = client.Hotel\
        .V1_0_0ShopHotelsContentChangePost(gethotelcontentchangerequest=j,
                                           mode='change'
                                           )\
        .result()

    assert 29 == len(change['GetHotelContentChangeRS']['ApplicationResults']
                     ['Success'][0]['timeStamp'])
コード例 #4
0
def test__v1_lists_utilities_airlines_alliances_get():
    client = get_client()

    alliances = client.Utility\
        .V1ListsUtilitiesAirlinesAlliancesGet(alliancecode='*S')\
        .result()
    assert 'SkyTeam' == alliances['AllianceInfo'][0]['AllianceName']
コード例 #5
0
def test__v1_0_0_shop_hotels_image_post():
    client = get_client()

    j = json.loads('''{
                      "GetHotelImageRQ": {
                        "HotelRefs": {
                          "HotelRef": [
                            {
                              "HotelCode": "1276",
                              "CodeContext": "Sabre"
                            }
                          ]
                        },
                        "ImageRef": {
                          "Type": "THUMBNAIL",
                          "CategoryCode": 3,
                          "LanguageCode": "EN"
                        }
                      }
                    }''')

    image = client.Hotel\
        .V1_0_0ShopHotelsImagePost(gethotelimagerequest=j,
                                   mode='image'
                                   )\
        .result()

    assert 29 == len(image['GetHotelImageRS']['ApplicationResults']['Success']
                     [0]['timeStamp'])
コード例 #6
0
def test__v1_lists_utilities_aircraft_equipment_get():
    client = get_client()

    equipment = client.Utility\
        .V1ListsUtilitiesAircraftEquipmentGet(aircraftcode='M80')\
        .result()
    assert 'M80' == equipment['AircraftInfo'][0]['AircraftCode']
def test__v1_lists_supported_cities_city_airports_get():
    client = get_client()

    airports = client.Air_Utility\
        .V1ListsSupportedCitiesCityAirportsGet(city='NYC')\
        .result()
    assert 'JFK' == airports['Airports'][0]['code']
コード例 #8
0
def test__v1_lists_supported_countries_get():
    client = get_client()

    countries = client.Air_Utility\
        .V1ListsSupportedCountriesGet(pointofsalecountry='NZ')\
        .result()
    assert 'NZ' == countries.PointOfSale
コード例 #9
0
def test__v1_0_0_shop_hotels_list_post():
    client = get_client()

    j = json.loads('''{
                        "GetHotelListRQ": {
                            "SearchCriteria": {
                                "IncludedFeatures": true, 
                                "HotelRefs": {
                                    "HotelRef": [
                                        {
                                            "HotelCode": "7521"
                                        }, 
                                        {
                                            "HotelCode": "22390"
                                        }, 
                                        {
                                            "HotelCode": "22570"
                                        }
                                    ]
                                }
                            }
                        }
                    }''')

    list = client.Hotel\
        .V1_0_0ShopHotelsListPost(gethotelslistrequest=j,
                                  mode='list'
                                  )\
        .result()

    assert 29 == len(list['GetHotelListRS']['ApplicationResults']['Success'][0]
                     ['timeStamp'])
コード例 #10
0
def test__v1_lists_supported_cities_get():
    client = get_client()

    supported_cities = client.Air_Utility\
        .V1ListsSupportedCitiesGet(country='US')\
        .result()
    assert 'LTS' == supported_cities['Cities'][0]['code']
コード例 #11
0
def test__v1_historical_flights_destination_seasonality_get():
    client = get_client()

    seasonality = client.Air_Intelligence\
        .V1HistoricalFlightsDestinationSeasonalityGet(destination='DFW')\
        .result()
    assert 'DFW' == seasonality['DestinationLocation']
コード例 #12
0
def test__v1_lists_utilities_views_view_get():
    client = get_client()

    view = client.Utility\
        .V1ListsUtilitiesViewsViewGet(view='BFM_ITIN_TOTAL_PRICE')\
        .result()

    assert 'BFM_ITIN_TOTAL_PRICE' == view['View']['Name']
コード例 #13
0
def test__v1_lists_supported_shop_themes_theme_get():
    client = get_client()

    travel_theme = \
        client.Air_Utility\
        .V1ListsSupportedShopThemesThemeGet(theme='BEACH')\
        .result()
    assert 'AAL' == travel_theme['Destinations'][0]['Destination']
コード例 #14
0
def test__v1_lists_utilities_views_get():
    client = get_client()

    views = client.Utility\
        .V1ListsUtilitiesViewsGet()\
        .result()

    assert 0 < len(views['Views'])
コード例 #15
0
def test__v1_lists_utilities_airlines_get():
    client = get_client()

    airline = client.Utility\
        .V1ListsUtilitiesAirlinesGet(airlinecode='B6')\
        .result()
    assert 'Jetblue Airways Corporation' == airline['AirlineInfo'][0][
        'AirlineName']
def test__v1_shop_flights_cheapest_fares_destination_get():
    client = get_client()

    cheapest_flights = client.Air_Search\
        .V1ShopFlightsCheapestFaresDestinationGet(destination='LAX',
                                                  pointofsalecountry='US'
                                                  )\
        .result()
    assert 'LAX' == cheapest_flights['DestinationLocation']
def test__v1_lists_utilities_geoservices_autocomplete_get():
    client = get_client()

    geo = client.Utility\
        .V1ListsUtilitiesGeoservicesAutocompleteGet(query='Dall')\
        .result()

    assert 0 < geo['Response']['grouped']['category:CITY']['doclist'][
        'numFound']
コード例 #18
0
def test_v2_shop_flights_fares_get_lead_price_calendar():
    client = get_client()

    fares = client.Air_Search\
        .V2ShopFlightsFaresGet(origin='JFK',
                               lengthofstay=5,
                               pointofsalecountry='US'
                               )\
        .result()
    assert 1 <= len(fares['FareInfo'][0]['CurrencyCode'])
コード例 #19
0
def test__v1_0_0_shop_hotels_media_post():
    client = get_client()

    j = json.loads('''{
                      "GetHotelMediaRQ":{
                        "HotelRefs":{
                          "HotelRef":[
                            {
                              "HotelCode":"62580",
                              "CodeContext":"Sabre",
                              "ImageRef":{
                                "MaxImages":"1",
                                "Images":{
                                  "Image":[
                                    {
                                      "Type":"THUMBNAIL"
                                    }
                                  ]
                                },
                                "Categories":{
                                  "Category":[
                                    {
                                      "Code":1
                                    }
                                  ]
                                },
                                "AdditionalInfo":{
                                  "Info":[
                                    {
                                      "Type":"CAPTION",
                                      "content":true
                                    }
                                  ]
                                },
                                "Languages":{
                                  "Language":[
                                    {
                                      "Code":"EN"
                                    }
                                  ]
                                }
                              }
                            }
                          ]
                        }
                      }
                    }''')

    media = client.Hotel\
        .V1_0_0ShopHotelsMediaPost(gethotelsmediarequest=j)\
        .result()

    assert 29 == len(media['GetHotelMediaRS']['ApplicationResults']
                     ['Success'][0]['timeStamp'])
コード例 #20
0
def test__v1_0_0_shop_hotels_chain_post():
    client = get_client()

    j = json.loads('''{"GetHotelChainInfoRQ": {}}''')

    hotel_chains = client.Hotel\
        .V1_0_0ShopHotelsChainPost(gethotelchaininforequest=j,
                                   mode='chain'
                                   )\
        .result()
    assert 29 == len(hotel_chains['GetHotelChainInfoRS']['ApplicationResults']
                     ['Success'][0]['timeStamp'])
コード例 #21
0
def test__v1_shop_flights_get():
    client = get_client()

    itineraries = client.Air_Search\
        .V1ShopFlightsGet(origin='JFK',
                          destination='LAX',
                          departuredate='2018-04-07',
                          returndate='2018-04-08',
                          eticketsonly='N',
                          pointofsalecountry='US'
                          )\
        .result()
    assert 'JFK' == itineraries['OriginLocation']
コード例 #22
0
def test__v1_forecast_flights_fares_get():
    client = get_client()

    departuredate = (datetime.now() + timedelta(days=7)).strftime('%Y-%m-%d')
    returndate = (datetime.now() + timedelta(days=14)).strftime('%Y-%m-%d')

    forecast = client.Air_Intelligence\
        .V1ForecastFlightsFaresGet(origin='JFK',
                                   destination='LAX',
                                   departuredate=departuredate,
                                   returndate=returndate
                                   )\
        .result()
    assert 'USD' == forecast['CurrencyCode']
コード例 #23
0
def test__v1_historical_shop_flights_fares_get():
    client = get_client()

    departuredate = (datetime.now() + timedelta(days=7)).strftime('%Y-%m-%d')
    returndate = (datetime.now() + timedelta(days=14)).strftime('%Y-%m-%d')

    forecast = client.Air_Intelligence\
        .V1HistoricalShopFlightsFaresGet(origin='JFK',
                                         destination='LAX',
                                         departuredate=departuredate,
                                         returndate=returndate,
                                         pointofsalecountry='US'
                                         )\
        .result()
    assert 'JFK' == forecast['OriginLocation']
def test__v1_lists_supported_countries_get():
    client = get_client()

    # Africa,Asia Pacific,Europe,Latin America,Middle East,North America
    travel_seasonality_destinations = (
                 client.Air_Utility
                 .V1ListsSupportedHistoricalSeasonalityAirportsGet(
                                                                   country='AE',
                                                                   region='Middle East')
                 .result()
                 )

    # entry for country=AE and region=Middle East should be DXB
    airport_code = (travel_seasonality_destinations['DestinationLocations'][0]
                    ['DestinationLocation']['AirportCode'])
    assert 'DXB' == airport_code
コード例 #25
0
def test__v1_historical_flights_fares_get():
    client = get_client()

    earliestdeparturedate = (datetime.now() +
                             timedelta(days=7)).strftime('%Y-%m-%d')
    latestdeparturedate = (datetime.now() +
                           timedelta(days=14)).strftime('%Y-%m-%d')

    forecast = client.Air_Intelligence\
        .V1HistoricalFlightsFaresGet(origin='JFK',
                                     destination='LAX',
                                     earliestdeparturedate=earliestdeparturedate,
                                     latestdeparturedate=latestdeparturedate,
                                     lengthofstay=4
                                     )\
        .result()
    assert 'JFK' == forecast['OriginLocation']
def test__v1_lists_supported_shop_flights_originsdestinations_get():
    client = get_client()

    # Africa,Asia Pacific,Europe,Latin America,Middle East,North America
    origins_destinations = (
        client.Air_Utility.V1ListsSupportedShopFlightsOriginsdestinationsGet(
            origincountry='US',
            destinationcountry='US',
            originregion='North America',
            destinationregion='North America',
            pointofsalecountry='US').result())

    # entry for country=AE and region=Middle East should be DXB
    destination_airport_code = (
        origins_destinations['OriginDestinationLocations'][0]
        ['DestinationLocation']['AirportCode'])
    assert 'MCO' == destination_airport_code
コード例 #27
0
def test__v1_lists_utilities_geocode_locations_post():
    client = get_client()

    j = json.loads('''[{
                        "GeoCodeRQ": {
                            "PlaceById": {
                                "Id": "DFW",
                                "BrowseCategory": {
                                    "name": "AIR"
                                }
                            }
                        }
                    }]''')

    geographic_information = client.Utility\
        .V1ListsUtilitiesGeocodeLocationsPost(geocoderequest=j)\
        .result()
    assert 'DFW' == geographic_information['Results'][0]['GeoCodeRS']['Place'][
        0]['Id']
コード例 #28
0
def test__v1_0_0_shop_hotels_content_post():
    client = get_client()

    j = json.loads('''{
                        "GetHotelContentRQ": {
                            "SearchCriteria": {
                                "HotelRefs": {
                                    "HotelRef": [{
                                        "HotelCode": "1"
                                    }, {
                                        "HotelCode": "1100"
                                    }]
                                },
                                "DescriptiveInfoRef": {
                                    "PropertyInfo": true,
                                    "LocationInfo": true,
                                    "Amenities": true,
                                    "Descriptions": {
                                        "Description": [{
                                            "Type": "Dining"
                                        }, {
                                            "Type": "Alerts"
                                        }]
                                    },
                                    "Airports": true,
                                    "AcceptedCreditCards": true
                                },
                                "ImageRef": {
                                    "MaxImages": "10"
                                }
                            }
                        }
                    }''')

    content = client.Hotel\
        .V1_0_0ShopHotelsContentPost(gethotelcontentrequest=j,
                                     mode='content'
                                     )\
        .result()

    assert 29 == len(content['GetHotelContentRS']['ApplicationResults']
                     ['Success'][0]['timeStamp'])
コード例 #29
0
def test__v2_4_0_shop_cars_post():
    client = get_client()

    j = json.loads('''{
                            "OTA_VehAvailRateRQ": {
                              "VehAvailRQCore": {
                                "QueryType": "Shop",
                                "VehRentalCore": {
                                  "PickUpDateTime": "04-07T09:00",
                                  "ReturnDateTime": "04-08T11:00",
                                  "PickUpLocation": {
                                    "LocationCode": "DFW"
                                  }
                                }
                              }
                            }
                        }''')

    available_vehicles = client.Ground_Transportation_Search\
        .V2_4_0ShopCarsPost(caravailabilityrequest=j
                            )\
        .result()
    assert 5 == len(available_vehicles['OTA_VehAvailRateRS']['Version'])
コード例 #30
0
import scabbard

client = scabbard.get_client()

countries = client.Air_Utility.V1ListsSupportedCountriesGet(
    pointofsalecountry='NZ').result()

print('PointOfSale')
print(countries['PointOfSale'])

print('OriginCountries')
for c in countries.OriginCountries:
    print(c['CountryCode'], c['CountryName'])

print('DestinationCountries')
for c in countries.DestinationCountries:
    print(c['CountryCode'], c['CountryName'])

print('Links')
for l in countries.Links:
    print(l['rel'])
    print(l['href'])