Skip to content

fix(scraper): follow UPS's Angular redesign via its JSON API#37

Merged
WolffRuoff merged 3 commits into
mainfrom
fix/ups-tracking-redesign
Jul 12, 2026
Merged

fix(scraper): follow UPS's Angular redesign via its JSON API#37
WolffRuoff merged 3 commits into
mainfrom
fix/ups-tracking-redesign

Conversation

@WolffRuoff

Copy link
Copy Markdown
Owner

Summary

  • UPS rebuilt tracking.ups.com as an Angular app; the #stApp container the scraper waited on no longer exists at all, so every UPS poll hung for the full 45s timeout and failed.
  • The failure log misattributed this to Akamai Bot Manager. That was a false positive: Akamai is just UPS's CDN, and its headers/domains (x-akamai-*, go-mpulse.net RUM, etc.) appear on every request whether or not Bot Manager actually intervened.
  • async_track now intercepts UPS's own internal JSON API (webapis.ups.com/track/api/Track/GetStatus), the same pattern already used for FedEx in fedex.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.
  • Tightened _identify_bot_service's Akamai branch to require actual challenge markers (_abck/ak_bmsc cookies, bm-verify, /_sec/verify, an AkamaiGHost edge 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)
  • Verified the new selectors and JSON API shape against the live UPS tracking page (real tracking number from the original failure) via a real browser session before writing the fix
  • Deploy and confirm a live poll cycle resolves UPS packages without timing out

🤖 Generated with Claude Code

WolffRuoff and others added 3 commits July 12, 2026 17:28
… 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>
@WolffRuoff
WolffRuoff merged commit b1e83cc into main Jul 12, 2026
5 checks passed
@WolffRuoff
WolffRuoff deleted the fix/ups-tracking-redesign branch July 12, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant