Extract HTTP response classifier into its own module
aistoy
d40c9c9
detect_block_page and BlockDetectionResult previously lived at the top
of browser.py, which made them unreachable without buying into the
whole CDP stack — pychrome import, ManagedBrowser, BrowserRunner.
After the CDP strip-out in the previous commit, the classifier is the
only piece worth keeping, and it has legitimate non-browser uses:
health checks, auto-heal, and future routing all want to tell "engine
got CAPTCHA'd" apart from "engine parser broke" without launching
Chrome.
Move just that code into src/scoutlet/response_classifier.py:
- BlockDetectionResult, detect_block_page unchanged
- _ENGINE_BLOCK_PATTERNS (google/bing/ddg) unchanged
- _GENERIC_BLOCK_KEYWORDS (Cloudflare/Akamai/PerimeterX/etc.) unchanged
- _BLOCK_PAGE_SIZE_THRESHOLD = 2048 unchanged
The module imports only `re` — no httpx, no lxml, no pychrome. The 11
test cases carry over verbatim from the deleted test_browser.py.