Skip to content

Commit 0b9561f

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#20)
1 parent 90ea00d commit 0b9561f

File tree

8 files changed

+98
-83
lines changed

8 files changed

+98
-83
lines changed

Diff for: .stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-0069ed71133ac7b0add07abd8562396c4b8e3c9a212e14a7586782eeed2ff373.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-0d0ad7d4de2fa0b930b8d72fe6539ab248c7ed684b2e12b327b3bc0a466f9cde.yml

Diff for: api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Methods:
4545
Types:
4646

4747
```python
48-
from browserbase.types import Session, SessionLiveURLs, SessionListResponse
48+
from browserbase.types import Session, SessionLiveURLs, SessionCreateResponse, SessionListResponse
4949
```
5050

5151
Methods:
5252

53-
- <code title="post /v1/sessions">client.sessions.<a href="./src/browserbase/resources/sessions/sessions.py">create</a>(\*\*<a href="src/browserbase/types/session_create_params.py">params</a>) -> <a href="./src/browserbase/types/session.py">Session</a></code>
53+
- <code title="post /v1/sessions">client.sessions.<a href="./src/browserbase/resources/sessions/sessions.py">create</a>(\*\*<a href="src/browserbase/types/session_create_params.py">params</a>) -> <a href="./src/browserbase/types/session_create_response.py">SessionCreateResponse</a></code>
5454
- <code title="get /v1/sessions/{id}">client.sessions.<a href="./src/browserbase/resources/sessions/sessions.py">retrieve</a>(id) -> <a href="./src/browserbase/types/session.py">Session</a></code>
5555
- <code title="post /v1/sessions/{id}">client.sessions.<a href="./src/browserbase/resources/sessions/sessions.py">update</a>(id, \*\*<a href="src/browserbase/types/session_update_params.py">params</a>) -> <a href="./src/browserbase/types/session.py">Session</a></code>
5656
- <code title="get /v1/sessions">client.sessions.<a href="./src/browserbase/resources/sessions/sessions.py">list</a>(\*\*<a href="src/browserbase/types/session_list_params.py">params</a>) -> <a href="./src/browserbase/types/session_list_response.py">SessionListResponse</a></code>

Diff for: src/browserbase/resources/sessions/downloads.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def list(
6767
"""
6868
if not id:
6969
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
70-
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
70+
extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
7171
return self._get(
7272
f"/v1/sessions/{id}/downloads",
7373
options=make_request_options(
@@ -122,7 +122,7 @@ async def list(
122122
"""
123123
if not id:
124124
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
125-
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
125+
extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
126126
return await self._get(
127127
f"/v1/sessions/{id}/downloads",
128128
options=make_request_options(

Diff for: src/browserbase/resources/sessions/sessions.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import Union, Iterable
65
from typing_extensions import Literal
76

87
import httpx
@@ -57,6 +56,7 @@
5756
from ...types.session import Session
5857
from ...types.session_live_urls import SessionLiveURLs
5958
from ...types.session_list_response import SessionListResponse
59+
from ...types.session_create_response import SessionCreateResponse
6060

6161
__all__ = ["SessionsResource", "AsyncSessionsResource"]
6262

@@ -104,15 +104,16 @@ def create(
104104
browser_settings: session_create_params.BrowserSettings | NotGiven = NOT_GIVEN,
105105
extension_id: str | NotGiven = NOT_GIVEN,
106106
keep_alive: bool | NotGiven = NOT_GIVEN,
107-
proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
107+
proxies: object | NotGiven = NOT_GIVEN,
108+
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
108109
api_timeout: int | NotGiven = NOT_GIVEN,
109110
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
110111
# The extra values given here take precedence over values defined on the client or passed to this method.
111112
extra_headers: Headers | None = None,
112113
extra_query: Query | None = None,
113114
extra_body: Body | None = None,
114115
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
115-
) -> Session:
116+
) -> SessionCreateResponse:
116117
"""Create a Session
117118
118119
Args:
@@ -130,6 +131,8 @@ def create(
130131
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
131132
configurations.
132133
134+
region: The region where the Session should run.
135+
133136
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
134137
the Project's `defaultTimeout`.
135138
@@ -150,14 +153,15 @@ def create(
150153
"extension_id": extension_id,
151154
"keep_alive": keep_alive,
152155
"proxies": proxies,
156+
"region": region,
153157
"timeout": api_timeout,
154158
},
155159
session_create_params.SessionCreateParams,
156160
),
157161
options=make_request_options(
158162
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
159163
),
160-
cast_to=Session,
164+
cast_to=SessionCreateResponse,
161165
)
162166

163167
def retrieve(
@@ -354,15 +358,16 @@ async def create(
354358
browser_settings: session_create_params.BrowserSettings | NotGiven = NOT_GIVEN,
355359
extension_id: str | NotGiven = NOT_GIVEN,
356360
keep_alive: bool | NotGiven = NOT_GIVEN,
357-
proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
361+
proxies: object | NotGiven = NOT_GIVEN,
362+
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
358363
api_timeout: int | NotGiven = NOT_GIVEN,
359364
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
360365
# The extra values given here take precedence over values defined on the client or passed to this method.
361366
extra_headers: Headers | None = None,
362367
extra_query: Query | None = None,
363368
extra_body: Body | None = None,
364369
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
365-
) -> Session:
370+
) -> SessionCreateResponse:
366371
"""Create a Session
367372
368373
Args:
@@ -380,6 +385,8 @@ async def create(
380385
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
381386
configurations.
382387
388+
region: The region where the Session should run.
389+
383390
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
384391
the Project's `defaultTimeout`.
385392
@@ -400,14 +407,15 @@ async def create(
400407
"extension_id": extension_id,
401408
"keep_alive": keep_alive,
402409
"proxies": proxies,
410+
"region": region,
403411
"timeout": api_timeout,
404412
},
405413
session_create_params.SessionCreateParams,
406414
),
407415
options=make_request_options(
408416
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
409417
),
410-
cast_to=Session,
418+
cast_to=SessionCreateResponse,
411419
)
412420

413421
async def retrieve(

Diff for: src/browserbase/types/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
from .context_create_response import ContextCreateResponse as ContextCreateResponse
1818
from .context_update_response import ContextUpdateResponse as ContextUpdateResponse
1919
from .extension_create_params import ExtensionCreateParams as ExtensionCreateParams
20+
from .session_create_response import SessionCreateResponse as SessionCreateResponse

Diff for: src/browserbase/types/session_create_params.py

+7-61
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

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

88
from .._utils import PropertyInfo
99

@@ -14,10 +14,6 @@
1414
"BrowserSettingsFingerprint",
1515
"BrowserSettingsFingerprintScreen",
1616
"BrowserSettingsViewport",
17-
"ProxiesUnionMember1",
18-
"ProxiesUnionMember1BrowserbaseProxyConfig",
19-
"ProxiesUnionMember1BrowserbaseProxyConfigGeolocation",
20-
"ProxiesUnionMember1ExternalProxyConfig",
2117
]
2218

2319

@@ -42,12 +38,15 @@ class SessionCreateParams(TypedDict, total=False):
4238
This is available on the Startup plan only.
4339
"""
4440

45-
proxies: Union[bool, Iterable[ProxiesUnionMember1]]
41+
proxies: object
4642
"""Proxy configuration.
4743
4844
Can be true for default proxy, or an array of proxy configurations.
4945
"""
5046

47+
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]
48+
"""The region where the Session should run."""
49+
5150
api_timeout: Annotated[int, PropertyInfo(alias="timeout")]
5251
"""Duration in seconds after which the session will automatically end.
5352
@@ -59,7 +58,7 @@ class BrowserSettingsContext(TypedDict, total=False):
5958
id: Required[str]
6059
"""The Context ID."""
6160

62-
persist: Required[bool]
61+
persist: bool
6362
"""Whether or not to persist the context after browsing. Defaults to `false`."""
6463

6564

@@ -131,56 +130,3 @@ class BrowserSettings(TypedDict, total=False):
131130
"""Enable or disable captcha solving in the browser. Defaults to `true`."""
132131

133132
viewport: BrowserSettingsViewport
134-
135-
136-
class ProxiesUnionMember1BrowserbaseProxyConfigGeolocation(TypedDict, total=False):
137-
country: Required[str]
138-
"""Country code in ISO 3166-1 alpha-2 format"""
139-
140-
city: str
141-
"""Name of the city. Use spaces for multi-word city names. Optional."""
142-
143-
state: str
144-
"""US state code (2 characters). Must also specify US as the country. Optional."""
145-
146-
147-
class ProxiesUnionMember1BrowserbaseProxyConfig(TypedDict, total=False):
148-
type: Required[Literal["browserbase"]]
149-
"""Type of proxy.
150-
151-
Always use 'browserbase' for the Browserbase managed proxy network.
152-
"""
153-
154-
domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
155-
"""Domain pattern for which this proxy should be used.
156-
157-
If omitted, defaults to all domains. Optional.
158-
"""
159-
160-
geolocation: ProxiesUnionMember1BrowserbaseProxyConfigGeolocation
161-
"""Configuration for geolocation"""
162-
163-
164-
class ProxiesUnionMember1ExternalProxyConfig(TypedDict, total=False):
165-
server: Required[str]
166-
"""Server URL for external proxy. Required."""
167-
168-
type: Required[Literal["external"]]
169-
"""Type of proxy. Always 'external' for this config."""
170-
171-
domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
172-
"""Domain pattern for which this proxy should be used.
173-
174-
If omitted, defaults to all domains. Optional.
175-
"""
176-
177-
password: str
178-
"""Password for external proxy authentication. Optional."""
179-
180-
username: str
181-
"""Username for external proxy authentication. Optional."""
182-
183-
184-
ProxiesUnionMember1: TypeAlias = Union[
185-
ProxiesUnionMember1BrowserbaseProxyConfig, ProxiesUnionMember1ExternalProxyConfig
186-
]

Diff for: src/browserbase/types/session_create_response.py

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal
6+
7+
from pydantic import Field as FieldInfo
8+
9+
from .._models import BaseModel
10+
11+
__all__ = ["SessionCreateResponse"]
12+
13+
14+
class SessionCreateResponse(BaseModel):
15+
id: str
16+
17+
connect_url: str = FieldInfo(alias="connectUrl")
18+
"""WebSocket URL to connect to the Session."""
19+
20+
created_at: datetime = FieldInfo(alias="createdAt")
21+
22+
expires_at: datetime = FieldInfo(alias="expiresAt")
23+
24+
keep_alive: bool = FieldInfo(alias="keepAlive")
25+
"""Indicates if the Session was created to be kept alive upon disconnections"""
26+
27+
project_id: str = FieldInfo(alias="projectId")
28+
"""The Project ID linked to the Session."""
29+
30+
proxy_bytes: int = FieldInfo(alias="proxyBytes")
31+
"""Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)"""
32+
33+
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]
34+
"""The region where the Session is running."""
35+
36+
selenium_remote_url: str = FieldInfo(alias="seleniumRemoteUrl")
37+
"""HTTP URL to connect to the Session."""
38+
39+
signing_key: str = FieldInfo(alias="signingKey")
40+
"""Signing key to use when connecting to the Session via HTTP."""
41+
42+
started_at: datetime = FieldInfo(alias="startedAt")
43+
44+
status: Literal["RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]
45+
46+
updated_at: datetime = FieldInfo(alias="updatedAt")
47+
48+
avg_cpu_usage: Optional[int] = FieldInfo(alias="avgCpuUsage", default=None)
49+
"""CPU used by the Session"""
50+
51+
context_id: Optional[str] = FieldInfo(alias="contextId", default=None)
52+
"""Optional. The Context linked to the Session."""
53+
54+
ended_at: Optional[datetime] = FieldInfo(alias="endedAt", default=None)
55+
56+
memory_usage: Optional[int] = FieldInfo(alias="memoryUsage", default=None)
57+
"""Memory used by the Session"""

0 commit comments

Comments
 (0)