fix(tradein): route yandex/valuation/imv/newbuilding scrapers через scraper_proxy_url #860
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#860
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-route-scrapers-through-proxy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Прокси (mobileproxy.space) КУПЛЕН и работает на проде (AVITO_PROXY_URL, egress=мобильный IP), но 5-6 скрейперов создавали curl_cffi-сессию БЕЗ proxy → datacenter-IP → бан (yandex T10 errors=3) / тихий None (on-demand cian/avito). Пробрасывает
settings.scraper_proxy_url(паттерн как в cian.py/avito.py; None → напрямую):n1, cian SERP, cian_detail, avito SERP — не тронуты (n1 by design, остальные уже с proxy). Парсинг не менялся.
+9 тестов (test_scraper_proxy.py): proxies прокинут + None-case + shared-session не пересоздаётся. 20/20 pass, ruff clean. (2 фейла cian_valuation/search-cache — pre-existing, в CI проходят.)
Yandex SERP was being banned (datacenter IP) and on-demand scrapers (cian_valuation, cian_newbuilding, avito_imv, avito_detail) silently returned None due to same cause. Mobile proxy was already wired for cian.py/cian_detail.py/avito.py but missing elsewhere. - yandex_realty: proxies= added to _CurlCffiSession in __aenter__ - yandex_valuation: proxies= added to _CurlCffiSession in __aenter__ - cian_valuation: proxies= added to AsyncSession (async with ... fetch block) - cian_newbuilding: proxies= added to both own-session paths (fetch_newbuilding + resolve_cian_zhk_url); shared-session callers unaffected - avito_imv: proxies= added to own-session path only (shared CffiAsyncSession from AvitoScraper already carries proxy) - avito_detail: proxies= added to own-session path only (scrape_pipeline passes shared session with proxy; admin endpoint creates own-session -> now proxied) All use pattern: _proxy = settings.scraper_proxy_url; proxies={"http":_proxy,"https":_proxy} if _proxy else None -- matching cian.py (#806 reference). proxy=None = direct connection (dev). Tests: 9 new proxy-wiring unit tests added to test_scraper_proxy.py (20 total, all pass).✅ APPROVE — завершение proxy-wiring для остальных scraper-сессий (#806 follow-up). Консистентно, shared-session не сломан.
Проверено:
_proxies = {http,https}=scraper_proxy_url if set else None→AsyncSession(proxies=_proxies). None→direct (dev-safe). Применён к yandex_realty/valuation__aenter__, cian_valuation, cian_newbuilding (fetch + resolve_zhk), avito_imv/detail (own-session).if cffi_session is None; переданная сессия (уже проксированная изAvitoScraper.__aenter__) — используется как есть черезelse, без override/double-proxy. Тестыshared_session_not_recreated/not_patchedподтверждают.settings.scraper_proxy_url(резолвится в продAVITO_PROXY_URL).isinstance(x, int|float)), без изменения логики.Anti-regression: 9 новых тестов (proxy forwarded + None + shared-not-recreated), 20/20. 2 предсущ. фейла cian_valuation/cache (проходят в CI, env-dependent — класс #851). Секретов нет (proxy из settings/env), инъекции нет, self-extending файлов нет.
Мержу. (#806 follow-up, без clean linked-issue.) Post-deploy: yandex sweep больше не errors=3 по бану.
bot-analyst referenced this pull request2026-05-31 10:40:51 +00:00