Booking

GRATIS CON POSSIBILITÀ DI UPGRADE
Da Api Dojo | Aggiornamento 7 days ago | Travel
Popolarità

9.9 / 10

Latenza

2,611ms

Livello di servizio

100%

Health Check

N/A

Torna a tutte le discussioni

hotel pricing

Rapid account: Andery 134467547
Andery134467547
9 months ago

Hello, I have a question regarding hotel pricing. I’m searching for prices using the ‘all_inclusive_price’ tag. On one hand, everything works fine, but on the other hand, there are instances (quite often) where the price under this tag is lower than the search on the website. Has anyone encountered this issue and can offer assistance? I would be very grateful!
code:
"import requests
url = "https://apidojo-booking-v1.p.rapidapi.com/locations/auto-complete"
city_name="Paris"
querystring = {“text”:city_name,“languagecode”:“en-us”}
headers = {
“X-RapidAPI-Key”: “fb37534b9cmsh41f27a9af552abdp16ca4ejsn0dd38bdd2404”,
“X-RapidAPI-Host”: “apidojo-booking-v1.p.rapidapi.com
}
response = requests.get(url, headers=headers, params=querystring)

data=response.json()
for entry in data:
city_ufi = entry.get(‘city_ufi’)
if city_ufi is not None:
fi=str(city_ufi)
break

url = “https://apidojo-booking-v1.p.rapidapi.com/properties/list

search_id = "none"
s = []
s1=[]
s2=[]
s3=[]
s4=[]
n=20
for i in range(0, 40):
querystring = {
“arrival_date”: “2023-09-25”,
“departure_date”: “2023-09-28”,
“guest_qty”: “1”,
“search_type”: “city”,
“dest_ids”: fi,
“room_qty”: “1”,
“search_id”: search_id,
“price_filter_currencycode”: “EUR”,
“order_by”: “popularity”,
“languagecode”: “en-us”,
“travel_purpose”: “leisure”,
“offset”: str(n)
}

response = requests.get(url, headers=headers, params=querystring)
data = response.json()
print(data)
hotel_names = []
price_breakdowns=[]
accommodation_type_names=[]
distance_to_ccs=[]
review_scores=[]

if "result" in data and isinstance(data["result"], list):
    for hotel in data["result"]:
        hotel_name = hotel.get("hotel_name", "N/A")
        price_breakdown = hotel.get("price_breakdown", {})
        all_inclusive_price = price_breakdown.get("all_inclusive_price", "N/A")
        accommodation_type_name=hotel.get("accommodation_type_name", "N/A")
        distance_to_cc=hotel.get("distance_to_cc", "N/A")
        review_score=hotel.get("review_score", "N/A")
        hotel_names.append(hotel_name)
        price_breakdowns.append(all_inclusive_price)
        accommodation_type_names.append(accommodation_type_name)
        distance_to_ccs.append(distance_to_cc)
        review_scores.append(review_score)

if len(hotel_names)==0:
    break
search_id = data.get("search_id", "N/A")
print(hotel_names)
print(price_breakdowns)
s.append(hotel_names)
s1.append(price_breakdowns)
s2.append(accommodation_type_names)
s3.append(distance_to_ccs)
s4.append(review_scores)
n=n+20
print(i)
input()

f=[]
g=[]
for i in range(0,len(s)):
f1=[]
for j in range(0,len(s[i])):
f1.append(str(s[i][j])+"----"+str(s1[i][j])+"----"+str(s2[i][j])+"----"+str(s3[i][j])+"----"+str(s4[i][j]))
g.append(str(s[i][j])+"----"+str(s1[i][j])+"----"+str(s2[i][j])+"----"+str(s3[i][j])+"----"+str(s4[i][j]))
f.append(f1)
unique_values = set()
print(len(f))
for lst in f:
unique_values.update(lst)

result_list = list(unique_values)
result_list.sort()

print(len(result_list))
all=[]
for i in range(0,len(result_list)):
a=result_list[i].split("----")
all.append(a)
print(len(all))
print(all)
print(len(g))"

Rapid account: Apidojo
apidojo Commented 9 months ago

Hello,

Don’t talk plain text. Please send along with the request/response and screenshot of the related property (taken at the same time) on booking.com as clue to demonstrate the case.

Regards.

Rapid account: Andery 134467547
Andery134467547 Commented 9 months ago

Unfortunately, no. I’ve also checked in the mobile app, and the prices often differ quite a bit. I’m searching using the ‘all_inclusive_price’ parameter. It’s possible that this isn’t the right parameter or there’s some error. I’ve tried checking multiple times already, but it keeps leading to the same result. Perhaps someone has already encountered this issue.

Rapid account: Apidojo
apidojo Commented 9 months ago

Hello,

This API prefers the data provided in the mobile application version of booking.com as it always has better price.

Regards.

Partecipa alla discussione - aggiungi un commento di seguito:

Accedi/Iscriviti per pubblicare nuovi commenti