human_requests.tools.helper_tools

helper_tools — helper utilities independent of a specific Session: - assembling/merging storage_state (cookies + localStorage) - unified navigation handler with soft retries

Functions

build_storage_state_for_context(...)

merge_storage_state_from_context(→ dict[str, dict[str, ...)

Reads storage_state from the context and synchronizes internal state:

handle_nav_with_retries(→ None)

Unified navigation handler with soft retries for goto/render.

Module Contents

build_storage_state_for_context(
*,
local_storage: dict[str, dict[str, str]],
cookie_manager: CookieManager,
) playwright.async_api.StorageState[source]
async merge_storage_state_from_context(
ctx: playwright.async_api.BrowserContext,
*,
cookie_manager: CookieManager,
) dict[str, dict[str, str]][source]

Reads storage_state from the context and synchronizes internal state: - localStorage: FULL overwrite and returned outward - cookies: ADD/UPDATE in the provided CookieManager

async handle_nav_with_retries(
page: playwright.async_api.Page,
*,
target_url: str,
wait_until: Literal['commit', 'load', 'domcontentloaded', 'networkidle'],
timeout_ms: int,
attempts: int,
on_retry: Callable[[], Awaitable[None]] | None = None,
) None[source]

Unified navigation handler with soft retries for goto/render. Catches ONLY PlaywrightTimeoutError. On retries calls on_retry() (if provided), then performs a reload (soft refresh).