mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-05 15:31:08 +00:00
browser headers polishing
This commit is contained in:
parent
2282794a1a
commit
579cde8ff3
2 changed files with 4 additions and 60 deletions
|
|
@ -39,18 +39,7 @@ class State:
|
|||
|
||||
# for some reason we need to provide exact path to headless shell, otherwise it looks for headed browser
|
||||
pw_binary = ensure_playwright_binary()
|
||||
|
||||
# Prepare HTTP headers with error handling
|
||||
try:
|
||||
http_headers = self.agent.config.browser_http_headers or {}
|
||||
if http_headers:
|
||||
PrintStyle().info(f"Using HTTP headers: {list(http_headers.keys())}")
|
||||
else:
|
||||
PrintStyle().info("No custom HTTP headers configured")
|
||||
except Exception as e:
|
||||
PrintStyle().warning(f"Error processing HTTP headers, using defaults: {e}")
|
||||
http_headers = {}
|
||||
|
||||
|
||||
self.browser_session = browser_use.BrowserSession(
|
||||
browser_profile=browser_use.BrowserProfile(
|
||||
headless=True,
|
||||
|
|
@ -75,8 +64,8 @@ class State:
|
|||
/ "profiles"
|
||||
/ f"agent_{self.agent.context.id}"
|
||||
),
|
||||
extra_http_headers=http_headers,
|
||||
)
|
||||
extra_http_headers=self.agent.config.browser_http_headers or {},
|
||||
)
|
||||
)
|
||||
|
||||
await self.browser_session.start() if self.browser_session else None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue