gendesign/tradein-mvp/backend/app/services/scrapers
lekss361 ee87575052 fix(tradein/avito): anti-bot hardening — sleep + abort + shared session
Production был заблокирован 23.05 17:48-17:55 MSK из-за tight loop без delay
в detail enrichment (~20 req/sec к Avito). Все 3 подряд runs получили 403.

Bundled fix:
1. AvitoBlockedError / AvitoRateLimitedError (новый avito_exceptions.py)
2. fetch_around, fetch_detail, fetch_house_catalog — raise на HTTP 403/429
3. scrape_pipeline: shared AsyncSession через весь sweep (один TLS handshake)
4. asyncio.sleep с +-20% random jitter между detail requests (default 7s)
5. Early abort: после 3 consecutive blocks — abort sweep + propagate
6. scrape_runs.mark_rate_limited (status=rate_limited vs failed/done)
7. detail_top_n default 20->10 в CitySweepStartRequest
8. logger.error вместо warning для 403/429 -> GlitchTip alert

Confirmed root cause: prod logs показали 403 в 40-60ms intervals
(blast pattern без delay между fetch_detail calls).
2026-05-23 23:00:23 +03:00
..
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
avito.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session 2026-05-23 23:00:23 +03:00
avito_detail.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session 2026-05-23 23:00:23 +03:00
avito_exceptions.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session 2026-05-23 23:00:23 +03:00
avito_houses.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session 2026-05-23 23:00:23 +03:00
avito_imv.py feat(tradein): avito_imv.py — Avito IMV evaluation API client (2 requests) (#444) 2026-05-23 12:16:47 +00:00
base.py feat(tradein): extend base.py save_listings to persist Cian-specific columns (PR #450 follow-up) (#455) 2026-05-23 13:05:20 +00:00
cian.py feat(tradein): global scraper delay setting (applies across all scrapers) (#485) 2026-05-23 15:43:28 +00:00
cian_detail.py feat(tradein): cian_session cookies management + admin endpoints (Wave 4 Worker A) (#457) 2026-05-23 13:22:00 +00:00
cian_newbuilding.py feat(tradein): cian_newbuilding.py — ЖК catalog scraper (chart + reliability + offers, Wave 4 Worker C) (#459) 2026-05-23 13:23:11 +00:00
cian_state_parser.py feat(tradein): cian_state_parser shared utility + ScrapedLot Cian fields (#447) 2026-05-23 12:35:01 +00:00
cian_valuation.py feat(tradein): cian_valuation.py — auth-required Calculator scraper + 24h cache (#465) 2026-05-23 13:43:34 +00:00
n1.py feat(tradein): global scraper delay setting (applies across all scrapers) (#485) 2026-05-23 15:43:28 +00:00
yandex_detail.py feat(tradein): scraper_settings live-config + Yandex admin trigger endpoints (#484) 2026-05-23 15:28:34 +00:00
yandex_helpers.py feat(tradein): yandex_helpers.py — JSON-LD + regex + date + NLP + money helpers (#456) 2026-05-23 13:14:11 +00:00
yandex_newbuilding.py feat(tradein): scraper_settings live-config + Yandex admin trigger endpoints (#484) 2026-05-23 15:28:34 +00:00
yandex_realty.py feat(tradein): scraper_settings live-config + Yandex admin trigger endpoints (#484) 2026-05-23 15:28:34 +00:00
yandex_valuation.py feat(tradein): scraper_settings live-config + Yandex admin trigger endpoints (#484) 2026-05-23 15:28:34 +00:00