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:
parent
c2e1a9703a
commit
68e8a6883b
3 changed files with 89 additions and 0 deletions
|
|
@ -44,6 +44,30 @@ class EviivoProfile(BaseProfile):
|
|||
return {"property_slug": m.group(1)}
|
||||
return None
|
||||
|
||||
async def fetch_category_names(self, client, params: dict) -> tuple[dict, dict]:
|
||||
slug = params["property_slug"]
|
||||
try:
|
||||
r = await client.get(f"https://via.eviivo.com/{slug}", headers=HEADERS, timeout=20)
|
||||
except Exception:
|
||||
return {}, {}
|
||||
if r.status_code != 200:
|
||||
return {}, {}
|
||||
room_names: dict[str, str] = {}
|
||||
rate_names: dict[str, str] = {}
|
||||
for tag in _TAG_RE.finditer(r.text):
|
||||
attrs = _extract_data_attrs(tag.group(0))
|
||||
room_id = attrs.get("room-type-id", "").strip()
|
||||
if not room_id:
|
||||
continue
|
||||
room_name = attrs.get("item-name", "").strip()
|
||||
rate_plan = attrs.get("rate-plan-name", "").strip()
|
||||
rate_id = f"{room_id}_{_slugify(rate_plan) if rate_plan else 'standard'}"
|
||||
if room_name:
|
||||
room_names[room_id] = room_name
|
||||
if rate_plan:
|
||||
rate_names[rate_id] = rate_plan
|
||||
return room_names, rate_names
|
||||
|
||||
async def fetch_arrival_dates(self, client, params: dict) -> list[str]:
|
||||
"""Return the next 90 days as ISO date strings starting from tomorrow.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue