Fix Guestline + Mews direct scrapers after engine API changes

Both competitor booking engines changed their API contracts, silently
breaking their direct scrapes ~16 days ago (200 responses with empty
bodies, so no exception was ever raised):

- Guestline: the /enhanced availability endpoint now returns a bare []
  for every date. Switch to the base /api/availabilities/{coll}/{hotel}
  endpoint, which returns {"rooms":[...]} with the same room shape.
- Mews: getAvailability now rejects the old body with "Invalid
  EnterpriseId" — it requires enterpriseId + serviceId. getPricing
  additionally requires currencyCode. Capture the enterprise's
  defaultCurrencyCode in _ensure_config and send all three.

Also stop last_scraped_at advancing when a run saves 0 rows, so the
overview no longer reports a phantom-fresh scrape while the per-date
data stays stale — the symptom that surfaced this.

Verified live: Three Ways now yields 41 rows/night, Old Stocks 10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-08-13 14:09:13 +00:00
parent 22e3670531
commit b916f1a09b
3 changed files with 31 additions and 14 deletions

View file

@ -39,11 +39,11 @@ class GuestlineProfile(BaseProfile):
hotel_id = params["hotel_id"]
collection_id = params.get("collection_id", "MT")
dep = (date.fromisoformat(arrival) + timedelta(days=nights)).isoformat()
url = f"https://booking.eu.guestline.app/api/availabilities/{collection_id}/{hotel_id}/enhanced"
url = f"https://booking.eu.guestline.app/api/availabilities/{collection_id}/{hotel_id}"
r = await client.get(url, params={
"arrival": arrival, "departure": dep, "adults": 2, "children": 0,
}, headers=HEADERS, timeout=20)
if r.status_code == 404:
return []
r.raise_for_status()
return r.json().get("availabilities", {}).get("rooms", [])
return r.json().get("rooms", [])