aeat.adapters.outbound.aeat.sede._notifications module

Read-only notifications/messages reader for the authenticated AEAT sede.

Captured against a production account; the sede exposes two notification surfaces:

  • Summary (/wlpl/GNNO-JDIT/ResumenInteresados) — unread notifications + unread communications, two tables keyed by número de certificado.

  • Query (/wlpl/GNNO-JDIT/SvInteresadosQuery?VEZ=BUSCAR1) — a full-text search form plus a results table with one row per (notification, communication, or pending) item.

Both surfaces are reachable on the www6 Cl@ve-dispatched subdomain; an earlier assumption that notifications lived only on www1 (cert-only) was wrong.

The reader is structurally read-only: no form submission, no state-changing URL. Acknowledgement (acuse) is a strictly local concern (the local inbox tracks read/unread); the reader never tells AEAT “this was read”.

Public surface: RemoteNotification, NotificationsSnapshot, parse_notifications_query(), parse_notifications_summary(), fetch_notifications_query(), fetch_notifications_summary().

class RemoteNotification(**data)[source]

Bases: BaseModel

One row of AEAT’s notifications/communications surface.

tipo distinguishes a formal Notificación (legally binding, triggers the ten-day acuse window) from a lighter-weight Comunicación. The pendiente value marks the placeholder state AEAT shows for items that have been issued but not yet delivered.

Variables:
  • certificado_id de certificado — 13-digit (or longer) AEAT identifier.

  • tipo – Row class — "notificacion" | "comunicacion" | "pendiente" | "unknown".

  • concepto – Free-text concepto / subject line (may be empty for pending rows).

  • titular_nif – NIF / NIE of the titular (verbatim from AEAT).

  • titular_nombre – Free-text nombre / razón social of the titular.

  • destinatario_nif – NIF of the destinatario (may equal titular).

  • destinatario_nombre – Free-text nombre / razón social of the destinatario.

  • fecha_emisionFecha de emisión as a local date.

  • fecha_notificacionFecha de notificación when the row has been delivered, else None.

  • modo_notificacion – Text AEAT prints for the delivery channel, or None when not yet delivered.

  • leidaTrue if AEAT marks the row as “Leída”, False otherwise, None for pending rows with no column value.

  • source_url – URL the row was scraped from.

  • mode – Structural read-only marker.

Parameters:
  • certificado_id (str)

  • tipo (Literal['notificacion', 'comunicacion', 'pendiente', 'unknown'])

  • concepto (str)

  • titular_nif (str)

  • titular_nombre (str)

  • destinatario_nif (str)

  • destinatario_nombre (str)

  • fecha_emision (date)

  • fecha_notificacion (date | None)

  • modo_notificacion (str | None)

  • leida (bool | None)

  • source_url (AnyHttpUrl)

  • mode (Literal['read'])

certificado_id: str
tipo: Literal['notificacion', 'comunicacion', 'pendiente', 'unknown']
concepto: str
titular_nif: str
titular_nombre: str
destinatario_nif: str
destinatario_nombre: str
fecha_emision: date
fecha_notificacion: date | None
modo_notificacion: str | None
leida: bool | None
source_url: AnyHttpUrl
mode: Literal['read']
class NotificationsSnapshot(**data)[source]

Bases: BaseModel

One sede-side capture of the entire notifications surface.

Variables:
  • rows – Every notification / communication the sede returned.

  • captured_at – UTC timestamp at snapshot completion.

  • source_url – The sede URL the rows were scraped from (summary or query, depending on caller choice).

  • mode – Structural read-only marker.

Parameters:
rows: tuple[RemoteNotification, ...]
captured_at: datetime
source_url: AnyHttpUrl
mode: Literal['read']
parse_notifications_query(html, *, source_url)[source]

Parse the full SvInteresadosQuery results table.

This is the canonical list view; every row carries the full column set (tipo, leída, modo de notificación, etc.). Prefer this over parse_notifications_summary() when a complete picture is needed.

Parameters:
  • html (str) – Raw HTML body of a SvInteresadosQuery results page.

  • source_url (str) – URL the HTML was scraped from (recorded on the returned snapshot).

Return type:

NotificationsSnapshot

Returns:

A NotificationsSnapshot with one row per item.

parse_notifications_summary(html, *, source_url)[source]

Parse the unread-summary ResumenInteresados tables.

The summary carries fewer columns per row (no leída / modo), so the returned RemoteNotification records leave those as None. Useful for a cheap unread count / dashboard view.

Parameters:
  • html (str) – Raw HTML body of a ResumenInteresados page.

  • source_url (str) – URL the HTML was scraped from.

Return type:

NotificationsSnapshot

Returns:

A NotificationsSnapshot with one row per item.

async fetch_notifications_summary(session, *, settings=None)[source]

Live-fetch ResumenInteresados using the authenticated session.

Parameters:
Return type:

NotificationsSnapshot

Returns:

A NotificationsSnapshot parsed from the live HTML.

async fetch_notifications_query(session, *, settings=None)[source]

Live-fetch SvInteresadosQuery (the full table) using Cl@ve.

Parameters:
Return type:

NotificationsSnapshot

Returns:

A NotificationsSnapshot parsed from the live HTML.