Repository navigation
Stop on a refused proxy before the first request; skip media through a proxy - #10
Merged
Merged
Conversation
…a through a proxy A proxy that answers 407 or 402 to a one-request pre-check (CONNECT plus HEAD /robots.txt on www.sleepnumber.com) now ends the run with exit 5 and <out>.latest_attempt.meta.json (status failed, stop_reason proxy_auth_failed / proxy_balance_exhausted), in http_scraper.py and all three browser engines, instead of failing every retry. Through a local proxy the browser engines abort image, media and font requests; --load-media or SLEEPNUMBER_LOAD_MEDIA=1 loads them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Runs through the residential proxy that this site needs (datacentre addresses get a CloudFront 403) spent traffic and time they did not need to:
Page.goto: Timeout ... exceeded. On 2026-10-20, three Playwright canary runs timed out this way for 60 s each before therequestspass reportedTunnel connection failed: 407.http_scraper.pydid not stop on the 407 either. It saw the 407 inside aProxyErrorbut treated it as a transport failure and retried.Resulting behaviour
http_scraper.py, Playwright, Selenium, pyppeteer). It is a CONNECT through the proxy plusHEAD /robots.txton www.sleepnumber.com, with no third-party IP service. It is shared code inproxy_check.py, so therequeststransport and the browsers use one implementation.SLEEPNUMBER_PROXY (or --proxy / --proxy-file). It exits 5 and writes<out>.latest_attempt.meta.jsonwithstatus: failedandstop_reason: proxy_auth_failed.proxy_balance_exhausted.<out>.meta.jsonand the previous output are untouched.--cdp-endpoint.context.routeabortsimage/media/font. This also covers--concurrencyworkers, which go through the same_launch_local.Fetch.enablewith Image/Media/Font patterns, on its own CDP session.page.setRequestInterceptionis not used because current Chromium no longer hasNetwork.setRequestInterception.Network.setBlockedURLsby file extension.--load-media(orSLEEPNUMBER_LOAD_MEDIA=1) turns it off. A hidden--block-mediaforces it on for tests and measurements.http_scraper.pyfetches the HTML document only, so there is nothing to block on that path.Evidence
http_scraper.scrape()driven on a 407: exit 5,_fetch_one_pagenever called, the attempt sidecar written, and the credential absent from the log.scrape()driven on a 407: exit 5 and no browser started.gate()call removed fromhttp_scraper.py→ "http_scraper: a 407 exits 5 before any page request".gate()call removed from each of the three engines → ": a 407 exits 5 without starting a browser".proxy_check.py: with blocking on, the server never saw the image, the video or the woff2 font, while the document, script and stylesheet loaded. This held on all three drivers.--category mattresses, media loaded vs--block-media:http_scraper.pyloads no sub-resource and produces the same rows as Playwright (measured in this repo on 2026-10-13);Not changed
🤖 Generated with Claude Code
https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8