aeat.adapters.outbound.aeat.browser.profile module

Profile defaults for Playwright browser sessions.

Profile is the small browser-runtime record consumed by adapters.outbound.aeat.browser.BrowserSession, adapters.outbound.aeat.browser.default_browser_session_factory(), and Sede helpers that open Playwright pages. It carries the profile name, fallback storage-state JSON path, optional user agent, and the locale/timezone values forwarded into browser.new_context(...).

The locale and timezone defaults are resolved lazily from core.config.Settings when a Profile is instantiated. Importing this module therefore does not construct settings or validate external constants for commands that never touch the browser adapter.

See also

adapters.outbound.aeat.browser.BrowserSession.create_context()

Consumes Profile to build Playwright context kwargs.

adapters.outbound.aeat.browser.opened_browser_page()

Uses Profile for short-lived Sede browser contexts.

class Profile(name, storage_state_path, user_agent=None, locale=<factory>, timezone_id=<factory>)[source]

Bases: object

Browser profile values forwarded into a Playwright context.

storage_state_path is a fallback path: auth providers and Sede readers may pass an explicit storage-state path or in-memory state to adapters.outbound.aeat.browser.BrowserSession.create_context(), which takes precedence. locale and timezone_id default from core.config.Settings at construction time unless supplied explicitly.

Variables:
  • name – A unique identifier for this profile.

  • storage_state_path – Path to the JSON file containing cookies and localStorage.

  • user_agent – Optional custom User-Agent string.

  • locale – Optional locale (e.g., ‘es-ES’); defaults to Settings.aeat_browser_locale.

  • timezone_id – Optional timezone (e.g., ‘Europe/Madrid’); defaults to Settings.aeat_browser_timezone.

Parameters:
  • name (str)

  • storage_state_path (Path)

  • user_agent (str | None)

  • locale (str | None)

  • timezone_id (str | None)

name: str
storage_state_path: Path
user_agent: str | None
locale: str | None
timezone_id: str | None
ensure_storage_dir()[source]

Create the parent directory for storage_state_path only.

BrowserSession.create_context calls this before deciding whether the fallback storage-state file exists. The method creates directories but never creates or mutates the storage-state JSON file itself.

Return type:

None