Skip to content

Commit 24c5262

Browse files
authored
Merge pull request #108 from browser-use/magnus/fix-v2-proxy-lowercase
Auto-lowercase proxyCountryCode in v2 SDK
2 parents dd0af6f + ba43f1f commit 24c5262

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

browser-use-node/src/v2/resources/browsers.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export class Browsers {
1919

2020
/** Create a new browser session. */
2121
create(body: CreateBrowserBody = {}): Promise<BrowserSessionItemView> {
22+
if (body.proxyCountryCode) {
23+
body = { ...body, proxyCountryCode: body.proxyCountryCode.toLowerCase() as any };
24+
}
2225
return this.http.post<BrowserSessionItemView>("/browsers", body);
2326
}
2427

browser-use-node/src/v2/resources/sessions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export class Sessions {
2020

2121
/** Create a new session. */
2222
create(body?: CreateSessionBody): Promise<SessionItemView> {
23+
if (body?.proxyCountryCode) {
24+
body = { ...body, proxyCountryCode: body.proxyCountryCode.toLowerCase() as any };
25+
}
2326
return this.http.post<SessionItemView>("/sessions", body);
2427
}
2528

browser-use-python/src/browser_use_sdk/v2/resources/browsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _build_create_body(
2727
if profile_id is not None:
2828
body["profileId"] = profile_id
2929
if proxy_country_code is not None:
30-
body["proxyCountryCode"] = proxy_country_code
30+
body["proxyCountryCode"] = proxy_country_code.lower() if isinstance(proxy_country_code, str) else proxy_country_code
3131
if timeout is not None:
3232
body["timeout"] = timeout
3333
if browser_screen_width is not None:

browser-use-python/src/browser_use_sdk/v2/resources/sessions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _build_create_body(
2929
if profile_id is not None:
3030
body["profileId"] = profile_id
3131
if proxy_country_code is not None:
32-
body["proxyCountryCode"] = proxy_country_code
32+
body["proxyCountryCode"] = proxy_country_code.lower() if isinstance(proxy_country_code, str) else proxy_country_code
3333
if start_url is not None:
3434
body["startUrl"] = start_url
3535
if browser_screen_width is not None:

0 commit comments

Comments
 (0)