Skip to content
On this page

API Reference

Full typed signatures and docstrings live in the source. Browse them on GitHub.

WebSkrap's public surface is re-exported from the top-level webskrap package.

Client and sessions

Symbol Description
WebSkrapClient Owns the browser lifecycle. Use it as an async context manager and call fetch() or search() for one-shot requests or session() for persistent sessions.
WebSkrapSession One browser kept open across requests. Exposes fetch(), search(), new_page(), close_page(), human_click(), human_type(), decline_cookies(), cookies(), and the underlying browser (CDPBrowser).
FetchResult Result of a fetch: url, final_url, status, ok, headers, text, title, cookies, timings, screenshot_path, and cookie_notice_declined. css() and css_first() query text as HTML.
parse_html(html) Parse any HTML string into an Element tree. Elements expose tag, attrs, parent, children, text, css(), and css_first().
SearchResult Result of a search: query, engine, the results page's url, final_url, status and ok, the capped hits, hits_total, timings, and cookie_notice_declined.
SearchHit One organic result: title, url with the click-tracking redirect unwrapped, and snippet.
decline_cookies(page) Click the reject control of a cookie consent notice on a CDPPage. Returns the strategy that clicked, or None.

Configuration

Symbol Description
SessionConfig Per-session or per-call settings: channel, headless, profile_mode, timeouts, user_data_dir, storage_state, resource_policy, decline_cookies, decline_cookies_timeout_ms, proxy, and stealth options.
ProxyConfig Proxy server with optional username and password.
ResourcePolicy Request-blocking preset: ALL, LITE, or DOCUMENTS.
SearchEngine Results page a search loads: BING (default) or DDG (DuckDuckGo HTML). Google is not offered.
WebRtcIPHandlingPolicy Allowed WebRTC ICE policy values: default, default_public_and_private_interfaces, default_public_interface_only, disable_non_proxied_udp.

CLI and MCP internals

webskrap.browser_session and webskrap.paths implement persistent CLI and MCP browser sessions, sandbox selection, profile storage, and confined MCP output. These modules are not re-exported from webskrap and are not part of the stable public Python API. Use the webskrap browser CLI or the MCP browser tools instead of importing their helpers directly.

Profiles

Symbol Description
BrowserProfile Browser-visible settings: viewport, screen, locale, timezone_id, navigator_languages, headers, and device characteristics. Keeps Accept-Language coherent.
Viewport A width / height pair used for viewport and screen dimensions.
get_profile(name) Return a copy of a built-in profile (desktop-chrome, desktop-edge, mobile-chrome).
list_profiles() List the built-in profiles.