aeat.adapters.outbound.aeat.browser._site_health_probe module

Private health-probe helper for adapters.outbound.aeat.browser.BrowserSession.

The session navigation hook calls this helper after every page.goto and before raising core.errors.SiteHealthError for non-OK classifications. Keeping the helper isolated makes the forbidden-import guard trivial: this module MUST NOT import anything from adapters.outbound.aeat.auth, application.filing, or domain.transactions.

See also

adapters.outbound.aeat.browser._site_health_parsers.evaluate_response()

Pure parser suite delegated to by probe_response().

adapters.outbound.aeat.browser._site_health.SiteHealthStatus

Concrete status record returned for maintenance, WAF, rate-limit, and unreachable classifications.

probe_response(url, http_status, headers, html, *, rate_limit_retry_after_default)[source]

Classify a response via the parser suite.

This is the narrow boundary between Playwright navigation and the pure parser code. It keeps BrowserSession dependent on one function while preserving the parser module’s lack of browser, auth, filing, or transaction imports.

Parameters:
  • url (str) – The probe URL whose response is being classified.

  • http_status (int) – The HTTP status code observed on the response.

  • headers (Mapping[str, str]) – Case-insensitive mapping of response headers.

  • html (str) – The response body.

  • rate_limit_retry_after_default (int) – Fallback Retry-After value used by the rate-limit parser when no header is present.

Return type:

SiteHealthStatus | None

Returns:

A SiteHealthStatus describing the detected non-OK state, or None when the response looks healthy.