Skip to content

Commit e0d813d

Browse files
committed
cloud browser unblock: add named session, drop proxy_pool/headers/body/method
Unblock always uses a residential proxy and performs a GET (ASP-bypass navigation to harvest cookies/clearance tokens), so the proxy pool selection and arbitrary HTTP method/body/headers params never applied. Add a session param for ASP session reconnection (disables auto-close on disconnect).
1 parent 8f01eaf commit e0d813d

1 file changed

Lines changed: 13 additions & 26 deletions

File tree

scrapfly/client.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,45 +1669,38 @@ def cloud_browser_project_salt(self) -> str:
16691669
def cloud_browser_unblock(
16701670
self,
16711671
url: str,
1672-
proxy_pool: Optional[str] = None,
16731672
country: Optional[str] = None,
16741673
os: Optional[str] = None,
16751674
browser_brand: Optional[str] = None,
1675+
session: Optional[str] = None,
16761676
timeout: Optional[int] = None,
16771677
browser_timeout: Optional[int] = None,
1678-
headers: Optional[Dict] = None,
1679-
body: Optional[str] = None,
1680-
method: Optional[str] = None,
16811678
enable_mcp: Optional[bool] = None,
16821679
debug: Optional[bool] = None,
16831680
) -> Dict:
16841681
"""
16851682
Bypass anti-bot protection and get a ready-to-use browser session.
1683+
1684+
Unblock always uses a residential proxy (no proxy pool selection) and
1685+
always performs a GET — the endpoint's purpose is to harvest cookies /
1686+
clearance tokens via an ASP-bypass navigation, not to proxy arbitrary
1687+
HTTP requests.
1688+
16861689
:param url: Target URL to navigate to and bypass protection
1687-
:param proxy_pool: Proxy pool: 'datacenter' or 'residential'
1688-
:param country: ISO country code for proxy geolocation
1690+
:param country: ISO country code for residential proxy geolocation
16891691
:param os: Operating system fingerprint: 'linux', 'windows', 'macos'
16901692
:param browser_brand: Browser brand fingerprint: 'chrome', 'edge', 'brave', 'opera'
1693+
:param session: Named session for reconnection — reuses the existing ASP
1694+
session when one exists and disables auto-close on disconnect
16911695
:param timeout: Navigation timeout in seconds (max 300)
16921696
:param browser_timeout: Browser session timeout in seconds (max 1800)
1693-
:param headers: Custom request headers
1694-
:param body: Request body for POST/PUT/PATCH requests
1695-
:param method: HTTP method: GET, POST, PUT, PATCH, DELETE
16961697
:param enable_mcp: Enable MCP streamable-HTTP endpoint on the session
16971698
:param debug: When True, the session is recorded and accessible via
16981699
cloud_browser_playback / cloud_browser_video using the returned run_id
16991700
:return: dict with ws_url, session_id, run_id
17001701
"""
1701-
proxy_pool_map = {
1702-
'datacenter': 'public_datacenter_pool',
1703-
'residential': 'public_residential_pool',
1704-
}
1705-
17061702
json_body = {'url': url}
17071703

1708-
if proxy_pool is not None:
1709-
json_body['proxy_pool'] = proxy_pool_map.get(proxy_pool, proxy_pool)
1710-
17111704
if country is not None:
17121705
json_body['country'] = country
17131706

@@ -1717,21 +1710,15 @@ def cloud_browser_unblock(
17171710
if browser_brand is not None:
17181711
json_body['browser_brand'] = browser_brand
17191712

1713+
if session is not None:
1714+
json_body['session'] = session
1715+
17201716
if timeout is not None:
17211717
json_body['timeout'] = timeout
17221718

17231719
if browser_timeout is not None:
17241720
json_body['browser_timeout'] = browser_timeout
17251721

1726-
if headers is not None:
1727-
json_body['headers'] = headers
1728-
1729-
if body is not None:
1730-
json_body['body'] = body
1731-
1732-
if method is not None:
1733-
json_body['method'] = method
1734-
17351722
if enable_mcp is not None:
17361723
json_body['enable_mcp'] = enable_mcp
17371724

0 commit comments

Comments
 (0)