fix(yandex): read predicted price from entity.predictions.predictedPrice (#1725) #1734
2 changed files with 10 additions and 5 deletions
|
|
@ -189,12 +189,15 @@ def _to_bigint(raw: Any) -> int | None:
|
|||
|
||||
|
||||
def _predicted_prices(entity: dict[str, Any]) -> tuple[int | None, int | None, int | None]:
|
||||
"""Extract (value, min, max) from entity.predictedPrice.predictedPrice.
|
||||
"""Extract (value, min, max) from entity.predictions.predictedPrice.
|
||||
|
||||
Yandex's own per-offer valuation. Fields are strings (e.g. "7554000").
|
||||
Returns (None, None, None) when the nested path is absent.
|
||||
Yandex's own per-offer valuation. The gate-API nests it under
|
||||
``predictions.predictedPrice`` (NOT ``predictedPrice.predictedPrice`` —
|
||||
that key does not exist; verified live 2026-06-18 against the gate-API).
|
||||
Fields are strings (e.g. "7554000"). Returns (None, None, None) when the
|
||||
nested path is absent (e.g. novostroyki offers carry no valuation).
|
||||
"""
|
||||
outer = entity.get("predictedPrice") or {}
|
||||
outer = entity.get("predictions") or {}
|
||||
inner = outer.get("predictedPrice") or {}
|
||||
if not isinstance(inner, dict):
|
||||
return None, None, None
|
||||
|
|
|
|||
|
|
@ -114,7 +114,9 @@ _ENTITY_RICH_OWNER: dict = {
|
|||
"trend": "DECREASED",
|
||||
"previous": 7500000,
|
||||
},
|
||||
"predictedPrice": {"predictedPrice": {"value": "7554000", "min": "7100000", "max": "8000000"}},
|
||||
# Real gate-API nests valuation under predictions.predictedPrice (verified
|
||||
# live 2026-06-18) — NOT predictedPrice.predictedPrice.
|
||||
"predictions": {"predictedPrice": {"value": "7554000", "min": "7100000", "max": "8000000"}},
|
||||
"area": {"value": 48.0},
|
||||
"roomsTotal": 2,
|
||||
"floorsOffered": [5],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue