cadrumo.adapters.outbound.aeat.sede.censal_datos module¶
Read-only censal consulta reader for the authenticated AEAT sede.
AEAT publishes the taxpayer’s own censal state at the Mis Datos
Censales launcher (MdcAcceso), whose <h1> is Consulta de Datos
Identificativos y Censales. The page renders three data groups as
table.celdasConBorde tables:
Datos Identificativos del Contribuyente — NIF, name, birth data, nationality, marital status, and the two electronic-notification flags. Rendered row-wise as
<b>-wrapped label / value pairs.Domicilio Fiscal and Domicilio de Notificación — each split across several tables rendered column-wise: a row of
<b>-wrapped labels followed by a row of values, positionally aligned.
Every table carries a title attribute naming its group, which is the
section discriminator; the <th> heading renders only on the first
table of each group.
This page sits next to a write surface. It renders Cambio de
Domicilio Fiscal / Cambio de Domicilio de Notificaciones / Baja de
Domicilio de Notificaciones buttons whose scripts build relative
ModifDomiDual / ModifDomiNotif targets, and it links the M036
filing tool. Reading the rendered DOM is a read; driving any of those
controls is not. This reader therefore navigates and parses only: it
submits nothing, fills nothing, clicks nothing, and
_assert_read_landing() fails closed at runtime if AEAT ever lands
it on a modification path. That runtime landing guard is the primary
wall; the module-level string check in the sede write-surface gate is
the weaker second one.
Public surface: parse_censal_datos(),
fetch_censal_datos(), censal_datos_url(), and
forbidden_censal_landing_marker(), exported so conformance gates
exercise the real refusal rule instead of mirroring it.
- parse_censal_datos(html, *, source_url)[source]¶
Parse a censal consulta page into a canonical censal observation.
- Parameters:
- Return type:
- Returns:
The application-owned observation carrying identity and both addresses.
- Raises:
SedeParseError – When the HTML cannot be parsed at all, or carries no censal data table.
- async fetch_censal_datos(session, *, taxpayer_nif, settings=None)[source]¶
Read the censal consulta surface with the authenticated session.
The read navigates to the consulta view and parses the rendered DOM. It never submits a form, fills a field, or activates a control, and it refuses at runtime if AEAT lands it on a censal modification path.
- Parameters:
session (
AeatSession) – An authenticatedAeatSessionwhose encrypted browser state carries valid AEAT cookies.taxpayer_nif (
str) – The session’s own tax identifier. The product does not support acting as a representative, so this must be the authenticated taxpayer rather than a represented third party.settings (
Settings|None) – Optionalcore.config.Settingsoverride.
- Return type:
- Returns:
The canonical application observation parsed from the live HTML.
- Raises:
SedeNavigationError – When no persisted auth session exists, the navigation fails, AEAT lands on a modification surface, or the landing carries neither censal data nor the page marker.
- censal_datos_url(taxpayer_nif, *, origin)[source]¶
Build the censal consulta URL for one taxpayer against a resolved origin.
originis required and has no default. It previously defaulted to the unnumberedsede.origin, which let a caller build a URL against a host that is not known to serve this route while believing it was the reader’s own address. The live read passes the host it read off the landed page.
- landed_on_censal_path(landing_url)[source]¶
Return whether a landing URL has arrived at the censal consulta path.
The single reader of this condition. The dispatch wait and the judgement that follows it both consult this, so a wait that expires on a page which did land cannot produce a different answer from the check that reports it.
- forbidden_censal_landing_marker(landing_url)[source]¶
Return the modification marker a landing carries, or
Noneif it is a read.This is the single matching rule behind the no-write guard, exposed so conformance gates can exercise the real logic rather than re-implement it — a mirrored copy would keep passing if this rule ever changed shape.