fix(scraper): follow UPS's Angular redesign via its JSON API#37
Merged
Conversation
… Akamai detection UPS rebuilt tracking.ups.com as an Angular app; the old #stApp DOM the scraper waited on no longer exists, so every UPS poll hung for 45s and timed out. The error log misattributed this to Akamai Bot Manager, but that was a false positive from a too-broad heuristic — Akamai is just UPS's CDN and its headers/domains appear on every request regardless of whether Bot Manager actually intervened. UPS's own app fetches tracking data from webapis.ups.com/track/api/Track/GetStatus, which returns full shipment history (shipmentProgressActivities) richer than anything in the rendered DOM. async_track now intercepts that response the same way fedex.py already does for FedEx, falling back to updated DOM selectors only if the API call is missed. Also tightened _identify_bot_service's Akamai branch to require actual challenge markers (_abck/ak_bmsc cookies, bm-verify, /_sec/verify, AkamaiGHost edge responses) instead of flagging any Akamai CDN header or mention, and fixed a dead case-sensitivity check in the Incapsula branch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
#stAppcontainer the scraper waited on no longer exists at all, so every UPS poll hung for the full 45s timeout and failed.x-akamai-*,go-mpulse.netRUM, etc.) appear on every request whether or not Bot Manager actually intervened.async_tracknow intercepts UPS's own internal JSON API (webapis.ups.com/track/api/Track/GetStatus), the same pattern already used for FedEx infedex.py. That endpoint returns full shipment history (shipmentProgressActivities) — richer than anything ever available in the rendered DOM, which only shows current status now. DOM parsing (updated to the new selectors) is kept only as a fallback if the API call is somehow missed._identify_bot_service's Akamai branch to require actual challenge markers (_abck/ak_bmsccookies,bm-verify,/_sec/verify, anAkamaiGHostedge response) instead of flagging on any Akamai CDN header or domain mention. Also fixed a dead case-sensitivity check in the Incapsula branch found while in there.Test plan
uv run pytest— full scraper suite passes (213 passed)🤖 Generated with Claude Code