Add fetch_category_names to Eviivo, QBook and Mews profiles

- Eviivo: no-dates page fetch returns all room types with data-item-name and
  data-rate-plan-name; single request populates the full name catalogue
- QBook: item_name already in /api/pull response; extracted on a dummy date
  call; no distinct rate plan names exposed so rate_labels left empty
- Mews: getCalendarData (bookingEngineId field) returns resourceCategories[].name
  and rates[].name as {en-US: ...} dicts; both room and rate labels populated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-10 13:00:19 +00:00
parent c2e1a9703a
commit 68e8a6883b
3 changed files with 89 additions and 0 deletions

View file

@ -43,6 +43,37 @@ class QBookProfile(BaseProfile):
dk = unquote(dk_match.group(1)) if dk_match else ""
return {"hotel_id": hotel_id, "dk": dk}
async def fetch_category_names(self, client, params: dict) -> tuple[dict, dict]:
hotel_id = params["hotel_id"]
dk = params["dk"]
from datetime import date, timedelta
tomorrow = (date.today() + timedelta(days=1)).isoformat()
day_after = (date.today() + timedelta(days=2)).isoformat()
try:
r = await client.get(
"https://web-bookings.hotels.uk.com/api/pull",
params={
"HotelAvailability": "", "k": _BUNDLE_K,
"HotelID": hotel_id, "from": tomorrow, "to": day_after,
"json": "", "dk": dk, "Qbook": "",
"GHABooking": "", "CookieBooking": "", "COOKIE_HotelID": "",
"guests": "", "adultsCheck": "", "childAges": "",
"roomId": "", "revised": "",
},
headers={**HEADERS, "Auth": _build_auth(hotel_id, tomorrow, day_after)},
timeout=20,
)
except Exception:
return {}, {}
if r.status_code != 200:
return {}, {}
room_names: dict[str, str] = {}
for item_id, item in r.json().get("availability", {}).items():
if isinstance(item, dict) and item.get("item_name"):
room_names[str(item_id)] = item["item_name"]
# QBook has no distinct rate plan names
return room_names, {}
async def fetch_arrival_dates(self, client, params: dict) -> list[str]:
today = date.today()
return [(today + timedelta(days=i)).isoformat() for i in range(1, 91)]