Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix/linting_issue
shubham-021b03d450c704f
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex 0d3d1a534..223265ca1 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -5,7 +5,7 @@ import loggingfrom functools import cached_propertyfrom pathlib import Pathfrom typing import TYPE_CHECKING, Any, Literal, Self, Union, cast, overload-from urllib.parse import urlunparse+from urllib.parse import urlparse, urlunparsefrom uuid import UUIDimport httpx@@ -1478,8 +1478,6 @@ class BrowserSession(BaseModel):self.logger.debug(f'Error stopping old CDP client: {e}')self._cdp_client_root = None- from urllib.parse import urlparse,urlunparse;-if not self.cdp_url.startswith('ws'):# If it's an HTTP URL, fetch the WebSocket URL from /json/version endpointparsed_url = urlparse(self.cdp_url)@@ -1487,15 +1485,10 @@ class BrowserSession(BaseModel):if not path.endswith('/json/version'):path = path + '/json/version'-- url = urlunparse((- parsed_url.scheme,- parsed_url.netloc,- path,- parsed_url.params,- parsed_url.query,- parsed_url.fragment- ))++ url = urlunparse(+ (parsed_url.scheme, parsed_url.netloc, path, parsed_url.params, parsed_url.query, parsed_url.fragment)+ )# Run a tiny HTTP client to query for the WebSocket URL from the /json/version endpointasync with httpx.AsyncClient() as client: