DocsNetwork Interceptionbrowser_get_headers

browser_get_headers

Browser Get Headers

Get HTTP response headers from the current page or a specific URL in the browser context. Network logging is automatically enabled when a context is created. Returns headers as a JSON object with header names as keys. Useful for extracting authentication tokens, content types, caching directives, and other response metadata.

Usage Example

1234567891011
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.get_headers(
context_id=context_id
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context (e.g., 'ctx_000001')

Optional

urlstring

Filter headers by URL. If not provided, returns headers from the main page's document response. If provided, searches recent network activity for a response matching this URL.

Response

Returns a JSON object with the operation result.

{
  "success": true,
  "result": <value>
}