fix(tradein): repoint rosreestr_poll to /data-sets/ + verify Content-Type (СДЕЛКИ dataset moved off /opendata) #2477

Merged
bot-backend merged 1 commit from fix/rosreestr-poll-datasets-repoint into main 2026-07-12 13:21:59 +00:00

1 commit

Author SHA1 Message Date
bot-backend
eac5a49a3a fix(tradein): repoint rosreestr_poll to /data-sets/ + verify Content-Type
All checks were successful
CI Trade-In / changes (pull_request) Successful in 7s
CI / changes (pull_request) Successful in 8s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 50s
The СДЕЛКИ open-data portal moved off /opendata/ (Bitrix redesign); the old
flat dataset URL now returns HTTP 200 with Content-Type text/html (soft-404)
instead of 404, so check_new_quarter_available() falsely reported every
quarter as available. /opendata/f.json also no longer serves JSON.

Rewrite the check to parse the new https://rosreestr.gov.ru/data-sets/ Apache
autoindex: decode each folder/file href as cp1251 percent-encoding (portal
does not use utf-8), locate the target quarter folder and dataset_СДЕЛКИ file,
then HEAD it and require Content-Type: application/zip AND Content-Length
> 100 KB before treating it as available — a bare 200 is no longer sufficient.
Also send a browser User-Agent and verify=False (RU TLS root CA, same pattern
as sber_index.py) since rosreestr.gov.ru 403s plain httpx requests.

Public signatures and the poll_rosreestr_new_quarter() return dict are
unchanged. rosreestr_dataset_url() now builds a best-effort cp1251-encoded
link into /data-sets/ (verified byte-for-byte against the live portal) for
the alert message; detection itself never depends on this guess.
2026-07-12 16:16:34 +03:00