"""Live AEAT session acquisition helpers.This module is the shared read-only entry gate for application-live services.It loads :class:`Settings`, enforces:meth:`aeat.core.access_gate.AeatAccessGate.require_live_read`, and only thenreturns an authenticated :class:`AeatSession`. It never calls``require_live_write`` and never performs AEAT-side mutations.See Also: :class:`~aeat.core.access_gate.AeatAccessGate` Core gate that authorizes pytest live reads and refuses all live writes. :func:`~aeat.application.auth.ensure_authenticated_aeat_session` Auth service called only after the read gate passes. :mod:`aeat.application.live` Public read-only live facade that routes remote acquisition helpers through this session boundary."""from__future__importannotationsfrom...adapters.outbound.aeat.authimportAeatSessionfrom...application.authimportensure_authenticated_aeat_sessionfrom...core.access_gateimportAeatAccessGatefrom...core.configimportSettings,load_settings
[docs]asyncdefactive_verified_session(*,operation:str="live-filed-read",target_url:str|None=None,)->tuple[AeatSession,Settings]:"""Return an :class:`AeatSession` and :class:`Settings` after the live-read gate. The ``operation`` and optional ``target_url`` are forwarded to the authentication service for diagnostics and provider routing after :class:`AeatAccessGate` has authorized a read-only live operation. """settings=load_settings()AeatAccessGate(settings).require_live_read()result=awaitensure_authenticated_aeat_session(settings,operation=operation,target_url=target_url,)returnresult.session,settings