def test_location_autosuggest_xml(self):
        hotels_service = Hotels(self.api_key, response_format="xml")

        self.result = hotels_service.location_autosuggest(
            market="DE", currency="EUR", locale="de-DE", query="Berlin"
        ).parsed

        self.assertTrue(None != self.result.find("./Results"))
        self.assertTrue(len(self.result.findall("./Results/HotelResultDto")) > 0)
    def test_location_autosuggest_xml(self):
        hotels_service = Hotels(self.api_key, response_format='xml')

        self.result = hotels_service.location_autosuggest(
            market='DE', currency='EUR', locale='de-DE', query='Berlin').parsed

        self.assertTrue(None != self.result.find('./Results'))
        self.assertTrue(
            len(self.result.findall('./Results/HotelResultDto')) > 0)
    def test_location_autosuggest_json(self):
        hotels_service = Hotels(self.api_key, response_format="json")

        self.result = hotels_service.location_autosuggest(
            market="UK", currency="GBP", locale="en-GB", query="Kuala"
        ).parsed

        self.assertTrue("results" in self.result)
        self.assertTrue(len(self.result["results"]) > 0)
    def test_location_autosuggest_json(self):
        hotels_service = Hotels(self.api_key, response_format='json')

        self.result = hotels_service.location_autosuggest(market='UK',
                                                          currency='GBP',
                                                          locale='en-GB',
                                                          query='Kuala').parsed

        self.assertTrue('results' in self.result)
        self.assertTrue(len(self.result['results']) > 0)
    def test_location_autosuggest_xml(self):
        hotels_service = Hotels(self.api_key, response_format='xml')

        self.result = hotels_service.location_autosuggest(
            market='DE',
            currency='EUR',
            locale='de-DE',
            query='Berlin').parsed

        self.assertIsNotNone(self.result.find('./Results'))
        self.assertTrue(len(self.result.findall('./Results/HotelResultDto')) > 0)
    def test_location_autosuggest_json(self):
        hotels_service = Hotels(self.api_key, response_format='json')

        self.result = hotels_service.location_autosuggest(
            market='UK',
            currency='GBP',
            locale='en-GB',
            query='Kuala').parsed

        self.assertTrue('results' in self.result)
        self.assertTrue(len(self.result['results']) > 0)
Esempio n. 7
0
def city_string_to_id_for_hotels(city_as_str):
    hotels_service = Hotels(API_KEY)
    city_suggestion_results = hotels_service.location_autosuggest(
        **{
            'market': 'TR',
            'currency': 'EUR',
            'locale': 'en-GB',
            'query': city_as_str
        }).json()['results']
    cities = list(
        filter(lambda x: x['geo_type'] == 'City', city_suggestion_results))

    if not cities:
        return None
    else:
        return cities[0]