cadrumo.adapters.outbound.aeat.browser.evasion module¶
Anti-bot evasion strategies for Playwright contexts.
adapters.outbound.aeat.browser.session.BrowserSession applies an
EvasionStrategy after creating each Playwright BrowserContext and
before returning it to auth providers or Sede readers. The default
PlaywrightStealthEvasion delegates to the optional
playwright-stealth package and raises BrowserEvasionError with a
typed terminal outcome when that package is unavailable.
See also
adapters.outbound.aeat.browser.session.BrowserSession.create_context()Applies the configured evasion strategy during context preparation.
adapters.outbound.aeat.browser.errors.BrowserFailureModeCarries
EVASION_FAILEDwhen strategy application fails inside the central session wrapper.
- class EvasionStrategy(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for applying evasion techniques to a Playwright context.
Custom implementations can be supplied to
BrowserSessiontests or adapter callers; production code defaults toPlaywrightStealthEvasion.
- class PlaywrightStealthEvasion[source]¶
Bases:
objectEvasion strategy backed by the
playwright-stealthpackage.Targets the
playwright-stealth2.x class-based API (Stealth().apply_stealth_async). The 1.x module-levelstealth_asynchelper was removed upstream.- async apply(context)[source]¶
Apply
playwright-stealthpatches tocontext.- Parameters:
context (
BrowserContext) – The Playwright BrowserContext to patch.- Raises:
BrowserEvasionError – If the
playwright-stealthpackage is not installed.- Return type: