Skip to content

Commit 1c149cb

Browse files
feat(api): api update
1 parent 976c1fb commit 1c149cb

14 files changed

+125
-202
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 19
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-be7a4aeebb1605262935b4b3ab446a95b1fad8a7d18098943dd548c8a486ef13.yml
3-
openapi_spec_hash: 1c950a109f80140711e7ae2cf87fddad
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-a2379f6bf614a1efd1bbb22b2191bf1a3daf09fd42267c8c54ce4284392d1ea4.yml
3+
openapi_spec_hash: 918f5ba73e08f044cfb77de95a8b7524
44
config_hash: b01d72cbe03bd762a73b05744086b2ec

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ from browserbase import Browserbase
135135
client = Browserbase()
136136

137137
session = client.sessions.create(
138-
project_id="projectId",
139138
browser_settings={},
140139
)
141140
print(session.browser_settings)

src/browserbase/resources/contexts.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import httpx
66

77
from ..types import context_create_params
8-
from .._types import Body, Query, Headers, NoneType, NotGiven, not_given
8+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
99
from .._utils import maybe_transform, async_maybe_transform
1010
from .._compat import cached_property
1111
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -46,7 +46,7 @@ def with_streaming_response(self) -> ContextsResourceWithStreamingResponse:
4646
def create(
4747
self,
4848
*,
49-
project_id: str,
49+
project_id: str | Omit = omit,
5050
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5151
# The extra values given here take precedence over values defined on the client or passed to this method.
5252
extra_headers: Headers | None = None,
@@ -60,7 +60,8 @@ def create(
6060
project_id: The Project ID.
6161
6262
Can be found in
63-
[Settings](https://www.browserbase.com/settings).
63+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
64+
the project will be inferred from the API key.
6465
6566
extra_headers: Send extra headers
6667
@@ -203,7 +204,7 @@ def with_streaming_response(self) -> AsyncContextsResourceWithStreamingResponse:
203204
async def create(
204205
self,
205206
*,
206-
project_id: str,
207+
project_id: str | Omit = omit,
207208
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
208209
# The extra values given here take precedence over values defined on the client or passed to this method.
209210
extra_headers: Headers | None = None,
@@ -217,7 +218,8 @@ async def create(
217218
project_id: The Project ID.
218219
219220
Can be found in
220-
[Settings](https://www.browserbase.com/settings).
221+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
222+
the project will be inferred from the API key.
221223
222224
extra_headers: Send extra headers
223225

src/browserbase/resources/sessions/sessions.py

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ def with_streaming_response(self) -> SessionsResourceWithStreamingResponse:
9999
def create(
100100
self,
101101
*,
102-
project_id: str,
103102
browser_settings: session_create_params.BrowserSettings | Omit = omit,
104103
extension_id: str | Omit = omit,
105104
keep_alive: bool | Omit = omit,
105+
project_id: str | Omit = omit,
106106
proxies: Union[Iterable[session_create_params.ProxiesUnionMember0], bool] | Omit = omit,
107107
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | Omit = omit,
108108
api_timeout: int | Omit = omit,
@@ -117,17 +117,18 @@ def create(
117117
"""Create a Session
118118
119119
Args:
120-
project_id: The Project ID.
120+
extension_id: The uploaded Extension ID.
121121
122-
Can be found in
123-
[Settings](https://www.browserbase.com/settings).
124-
125-
extension_id: The uploaded Extension ID. See
122+
See
126123
[Upload Extension](/reference/api/upload-an-extension).
127124
128125
keep_alive: Set to true to keep the session alive even after disconnections. Available on
129126
the Hobby Plan and above.
130127
128+
project_id: The Project ID. Can be found in
129+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
130+
the project will be inferred from the API key.
131+
131132
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
132133
configurations.
133134
@@ -151,10 +152,10 @@ def create(
151152
"/v1/sessions",
152153
body=maybe_transform(
153154
{
154-
"project_id": project_id,
155155
"browser_settings": browser_settings,
156156
"extension_id": extension_id,
157157
"keep_alive": keep_alive,
158+
"project_id": project_id,
158159
"proxies": proxies,
159160
"region": region,
160161
"api_timeout": api_timeout,
@@ -205,26 +206,26 @@ def update(
205206
self,
206207
id: str,
207208
*,
208-
project_id: str,
209209
status: Literal["REQUEST_RELEASE"],
210+
project_id: str | Omit = omit,
210211
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211212
# The extra values given here take precedence over values defined on the client or passed to this method.
212213
extra_headers: Headers | None = None,
213214
extra_query: Query | None = None,
214215
extra_body: Body | None = None,
215216
timeout: float | httpx.Timeout | None | NotGiven = not_given,
216217
) -> SessionUpdateResponse:
217-
"""Update a Session
218+
"""
219+
Update a Session
218220
219221
Args:
220-
project_id: The Project ID.
221-
222-
Can be found in
223-
[Settings](https://www.browserbase.com/settings).
224-
225222
status: Set to `REQUEST_RELEASE` to request that the session complete. Use before
226223
session's timeout to avoid additional charges.
227224
225+
project_id: The Project ID. Can be found in
226+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
227+
the project will be inferred from the API key.
228+
228229
extra_headers: Send extra headers
229230
230231
extra_query: Add additional query parameters to the request
@@ -239,8 +240,8 @@ def update(
239240
f"/v1/sessions/{id}",
240241
body=maybe_transform(
241242
{
242-
"project_id": project_id,
243243
"status": status,
244+
"project_id": project_id,
244245
},
245246
session_update_params.SessionUpdateParams,
246247
),
@@ -370,10 +371,10 @@ def with_streaming_response(self) -> AsyncSessionsResourceWithStreamingResponse:
370371
async def create(
371372
self,
372373
*,
373-
project_id: str,
374374
browser_settings: session_create_params.BrowserSettings | Omit = omit,
375375
extension_id: str | Omit = omit,
376376
keep_alive: bool | Omit = omit,
377+
project_id: str | Omit = omit,
377378
proxies: Union[Iterable[session_create_params.ProxiesUnionMember0], bool] | Omit = omit,
378379
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | Omit = omit,
379380
api_timeout: int | Omit = omit,
@@ -388,17 +389,18 @@ async def create(
388389
"""Create a Session
389390
390391
Args:
391-
project_id: The Project ID.
392+
extension_id: The uploaded Extension ID.
392393
393-
Can be found in
394-
[Settings](https://www.browserbase.com/settings).
395-
396-
extension_id: The uploaded Extension ID. See
394+
See
397395
[Upload Extension](/reference/api/upload-an-extension).
398396
399397
keep_alive: Set to true to keep the session alive even after disconnections. Available on
400398
the Hobby Plan and above.
401399
400+
project_id: The Project ID. Can be found in
401+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
402+
the project will be inferred from the API key.
403+
402404
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
403405
configurations.
404406
@@ -422,10 +424,10 @@ async def create(
422424
"/v1/sessions",
423425
body=await async_maybe_transform(
424426
{
425-
"project_id": project_id,
426427
"browser_settings": browser_settings,
427428
"extension_id": extension_id,
428429
"keep_alive": keep_alive,
430+
"project_id": project_id,
429431
"proxies": proxies,
430432
"region": region,
431433
"api_timeout": api_timeout,
@@ -476,26 +478,26 @@ async def update(
476478
self,
477479
id: str,
478480
*,
479-
project_id: str,
480481
status: Literal["REQUEST_RELEASE"],
482+
project_id: str | Omit = omit,
481483
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
482484
# The extra values given here take precedence over values defined on the client or passed to this method.
483485
extra_headers: Headers | None = None,
484486
extra_query: Query | None = None,
485487
extra_body: Body | None = None,
486488
timeout: float | httpx.Timeout | None | NotGiven = not_given,
487489
) -> SessionUpdateResponse:
488-
"""Update a Session
490+
"""
491+
Update a Session
489492
490493
Args:
491-
project_id: The Project ID.
492-
493-
Can be found in
494-
[Settings](https://www.browserbase.com/settings).
495-
496494
status: Set to `REQUEST_RELEASE` to request that the session complete. Use before
497495
session's timeout to avoid additional charges.
498496
497+
project_id: The Project ID. Can be found in
498+
[Settings](https://www.browserbase.com/settings). Optional - if not provided,
499+
the project will be inferred from the API key.
500+
499501
extra_headers: Send extra headers
500502
501503
extra_query: Add additional query parameters to the request
@@ -510,8 +512,8 @@ async def update(
510512
f"/v1/sessions/{id}",
511513
body=await async_maybe_transform(
512514
{
513-
"project_id": project_id,
514515
"status": status,
516+
"project_id": project_id,
515517
},
516518
session_update_params.SessionUpdateParams,
517519
),

src/browserbase/types/context_create_params.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, Annotated, TypedDict
5+
from typing_extensions import Annotated, TypedDict
66

77
from .._utils import PropertyInfo
88

99
__all__ = ["ContextCreateParams"]
1010

1111

1212
class ContextCreateParams(TypedDict, total=False):
13-
project_id: Required[Annotated[str, PropertyInfo(alias="projectId")]]
13+
project_id: Annotated[str, PropertyInfo(alias="projectId")]
1414
"""The Project ID.
1515
16-
Can be found in [Settings](https://www.browserbase.com/settings).
16+
Can be found in [Settings](https://www.browserbase.com/settings). Optional - if
17+
not provided, the project will be inferred from the API key.
1718
"""

src/browserbase/types/session_create_params.py

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,25 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, List, Union, Iterable
5+
from typing import Dict, Union, Iterable
66
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
77

8-
from .._types import SequenceNotStr
98
from .._utils import PropertyInfo
109

1110
__all__ = [
1211
"SessionCreateParams",
1312
"BrowserSettings",
1413
"BrowserSettingsContext",
15-
"BrowserSettingsFingerprint",
16-
"BrowserSettingsFingerprintScreen",
1714
"BrowserSettingsViewport",
1815
"ProxiesUnionMember0",
1916
"ProxiesUnionMember0UnionMember0",
2017
"ProxiesUnionMember0UnionMember0Geolocation",
2118
"ProxiesUnionMember0UnionMember1",
19+
"ProxiesUnionMember0UnionMember2",
2220
]
2321

2422

2523
class SessionCreateParams(TypedDict, total=False):
26-
project_id: Required[Annotated[str, PropertyInfo(alias="projectId")]]
27-
"""The Project ID.
28-
29-
Can be found in [Settings](https://www.browserbase.com/settings).
30-
"""
31-
3224
browser_settings: Annotated[BrowserSettings, PropertyInfo(alias="browserSettings")]
3325

3426
extension_id: Annotated[str, PropertyInfo(alias="extensionId")]
@@ -43,6 +35,13 @@ class SessionCreateParams(TypedDict, total=False):
4335
Available on the Hobby Plan and above.
4436
"""
4537

38+
project_id: Annotated[str, PropertyInfo(alias="projectId")]
39+
"""The Project ID.
40+
41+
Can be found in [Settings](https://www.browserbase.com/settings). Optional - if
42+
not provided, the project will be inferred from the API key.
43+
"""
44+
4645
proxies: Union[Iterable[ProxiesUnionMember0], bool]
4746
"""Proxy configuration.
4847
@@ -74,36 +73,6 @@ class BrowserSettingsContext(TypedDict, total=False):
7473
"""Whether or not to persist the context after browsing. Defaults to `false`."""
7574

7675

77-
class BrowserSettingsFingerprintScreen(TypedDict, total=False):
78-
max_height: Annotated[int, PropertyInfo(alias="maxHeight")]
79-
80-
max_width: Annotated[int, PropertyInfo(alias="maxWidth")]
81-
82-
min_height: Annotated[int, PropertyInfo(alias="minHeight")]
83-
84-
min_width: Annotated[int, PropertyInfo(alias="minWidth")]
85-
86-
87-
class BrowserSettingsFingerprint(TypedDict, total=False):
88-
"""
89-
See usage examples [on the Stealth Mode page](/features/stealth-mode#fingerprinting)
90-
"""
91-
92-
browsers: List[Literal["chrome", "edge", "firefox", "safari"]]
93-
94-
devices: List[Literal["desktop", "mobile"]]
95-
96-
http_version: Annotated[Literal["1", "2"], PropertyInfo(alias="httpVersion")]
97-
98-
locales: SequenceNotStr[str]
99-
100-
operating_systems: Annotated[
101-
List[Literal["android", "ios", "linux", "macos", "windows"]], PropertyInfo(alias="operatingSystems")
102-
]
103-
104-
screen: BrowserSettingsFingerprintScreen
105-
106-
10776
class BrowserSettingsViewport(TypedDict, total=False):
10877
height: int
10978
"""The height of the browser."""
@@ -139,12 +108,6 @@ class BrowserSettings(TypedDict, total=False):
139108
See [Upload Extension](/reference/api/upload-an-extension).
140109
"""
141110

142-
fingerprint: BrowserSettingsFingerprint
143-
"""
144-
See usage examples
145-
[on the Stealth Mode page](/features/stealth-mode#fingerprinting)
146-
"""
147-
148111
log_session: Annotated[bool, PropertyInfo(alias="logSession")]
149112
"""Enable or disable session logging. Defaults to `true`."""
150113

@@ -213,4 +176,17 @@ class ProxiesUnionMember0UnionMember1(TypedDict, total=False):
213176
"""Username for external proxy authentication. Optional."""
214177

215178

216-
ProxiesUnionMember0: TypeAlias = Union[ProxiesUnionMember0UnionMember0, ProxiesUnionMember0UnionMember1]
179+
class ProxiesUnionMember0UnionMember2(TypedDict, total=False):
180+
type: Required[Literal["none"]]
181+
"""Type of proxy. Always 'none' for this config."""
182+
183+
domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
184+
"""Domain pattern for which this proxy should be used.
185+
186+
If omitted, defaults to all domains. Optional.
187+
"""
188+
189+
190+
ProxiesUnionMember0: TypeAlias = Union[
191+
ProxiesUnionMember0UnionMember0, ProxiesUnionMember0UnionMember1, ProxiesUnionMember0UnionMember2
192+
]

0 commit comments

Comments
 (0)