diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index aaf968a..b56c3d0 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.3"
+ ".": "0.1.0-alpha.4"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index b492b7b..3d4a375 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 18
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-9af27d5ca04efd55b732756ee4c81b76331e5ee8ab8c74576a3eaf16faac44f1.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-b37d85811d1ccbd73a7884f22792503aa7e3103d378c97c84028b8b3b79acddc.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a09837..4c057cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+## 0.1.0-alpha.4 (2024-10-27)
+
+Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/browserbase/sdk-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
+
+### Features
+
+* **api:** update via SDK Studio ([#16](https://github.com/browserbase/sdk-python/issues/16)) ([78347f5](https://github.com/browserbase/sdk-python/commit/78347f5f2a251eca20ffeb1e5d78ee843ce74415))
+* **api:** update via SDK Studio ([#18](https://github.com/browserbase/sdk-python/issues/18)) ([b958c13](https://github.com/browserbase/sdk-python/commit/b958c13c01fd9f0cedbb5723ee54574ad769b539))
+* **api:** update via SDK Studio ([#19](https://github.com/browserbase/sdk-python/issues/19)) ([90ea00d](https://github.com/browserbase/sdk-python/commit/90ea00def3c88ff0b1a6d71b65abd155b230e2c0))
+* **api:** update via SDK Studio ([#20](https://github.com/browserbase/sdk-python/issues/20)) ([0b9561f](https://github.com/browserbase/sdk-python/commit/0b9561f5c8a91ea372ab68d5679e05e255f302c7))
+* **api:** update via SDK Studio ([#21](https://github.com/browserbase/sdk-python/issues/21)) ([00b8c8b](https://github.com/browserbase/sdk-python/commit/00b8c8be7b5bdf9fbe8da6410cf7dd2d002ad21e))
+
## 0.1.0-alpha.3 (2024-10-26)
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/browserbase/sdk-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
diff --git a/api.md b/api.md
index 40594f6..3f21eb2 100644
--- a/api.md
+++ b/api.md
@@ -45,12 +45,12 @@ Methods:
Types:
```python
-from browserbase.types import Session, SessionLiveURLs, SessionListResponse
+from browserbase.types import Session, SessionLiveURLs, SessionCreateResponse, SessionListResponse
```
Methods:
-- client.sessions.create(\*\*params) -> Session
+- client.sessions.create(\*\*params) -> SessionCreateResponse
- client.sessions.retrieve(id) -> Session
- client.sessions.update(id, \*\*params) -> Session
- client.sessions.list(\*\*params) -> SessionListResponse
diff --git a/pyproject.toml b/pyproject.toml
index cc49716..67b0716 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "browserbase"
-version = "0.1.0-alpha.3"
+version = "0.1.0-alpha.4"
description = "The official Python library for the browserbase API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/browserbase/_version.py b/src/browserbase/_version.py
index 25f9355..1719633 100644
--- a/src/browserbase/_version.py
+++ b/src/browserbase/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "browserbase"
-__version__ = "0.1.0-alpha.3" # x-release-please-version
+__version__ = "0.1.0-alpha.4" # x-release-please-version
diff --git a/src/browserbase/resources/sessions/downloads.py b/src/browserbase/resources/sessions/downloads.py
index 5b60ffe..461163b 100644
--- a/src/browserbase/resources/sessions/downloads.py
+++ b/src/browserbase/resources/sessions/downloads.py
@@ -67,7 +67,7 @@ def list(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
+ extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
return self._get(
f"/v1/sessions/{id}/downloads",
options=make_request_options(
@@ -122,7 +122,7 @@ async def list(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
+ extra_headers = {"Accept": "application/zip", **(extra_headers or {})}
return await self._get(
f"/v1/sessions/{id}/downloads",
options=make_request_options(
diff --git a/src/browserbase/resources/sessions/sessions.py b/src/browserbase/resources/sessions/sessions.py
index f50cf0d..d298c01 100644
--- a/src/browserbase/resources/sessions/sessions.py
+++ b/src/browserbase/resources/sessions/sessions.py
@@ -2,7 +2,6 @@
from __future__ import annotations
-from typing import Union, Iterable
from typing_extensions import Literal
import httpx
@@ -57,6 +56,7 @@
from ...types.session import Session
from ...types.session_live_urls import SessionLiveURLs
from ...types.session_list_response import SessionListResponse
+from ...types.session_create_response import SessionCreateResponse
__all__ = ["SessionsResource", "AsyncSessionsResource"]
@@ -104,7 +104,8 @@ def create(
browser_settings: session_create_params.BrowserSettings | NotGiven = NOT_GIVEN,
extension_id: str | NotGiven = NOT_GIVEN,
keep_alive: bool | NotGiven = NOT_GIVEN,
- proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
+ proxies: object | NotGiven = NOT_GIVEN,
+ region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
api_timeout: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -112,7 +113,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Session:
+ ) -> SessionCreateResponse:
"""Create a Session
Args:
@@ -130,6 +131,8 @@ def create(
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
configurations.
+ region: The region where the Session should run.
+
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
the Project's `defaultTimeout`.
@@ -150,6 +153,7 @@ def create(
"extension_id": extension_id,
"keep_alive": keep_alive,
"proxies": proxies,
+ "region": region,
"timeout": api_timeout,
},
session_create_params.SessionCreateParams,
@@ -157,7 +161,7 @@ def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=Session,
+ cast_to=SessionCreateResponse,
)
def retrieve(
@@ -354,7 +358,8 @@ async def create(
browser_settings: session_create_params.BrowserSettings | NotGiven = NOT_GIVEN,
extension_id: str | NotGiven = NOT_GIVEN,
keep_alive: bool | NotGiven = NOT_GIVEN,
- proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
+ proxies: object | NotGiven = NOT_GIVEN,
+ region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
api_timeout: int | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -362,7 +367,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Session:
+ ) -> SessionCreateResponse:
"""Create a Session
Args:
@@ -380,6 +385,8 @@ async def create(
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
configurations.
+ region: The region where the Session should run.
+
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
the Project's `defaultTimeout`.
@@ -400,6 +407,7 @@ async def create(
"extension_id": extension_id,
"keep_alive": keep_alive,
"proxies": proxies,
+ "region": region,
"timeout": api_timeout,
},
session_create_params.SessionCreateParams,
@@ -407,7 +415,7 @@ async def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=Session,
+ cast_to=SessionCreateResponse,
)
async def retrieve(
diff --git a/src/browserbase/types/__init__.py b/src/browserbase/types/__init__.py
index fcbbf0a..ebc243d 100644
--- a/src/browserbase/types/__init__.py
+++ b/src/browserbase/types/__init__.py
@@ -17,3 +17,4 @@
from .context_create_response import ContextCreateResponse as ContextCreateResponse
from .context_update_response import ContextUpdateResponse as ContextUpdateResponse
from .extension_create_params import ExtensionCreateParams as ExtensionCreateParams
+from .session_create_response import SessionCreateResponse as SessionCreateResponse
diff --git a/src/browserbase/types/context.py b/src/browserbase/types/context.py
index ed5135b..cb5c32f 100644
--- a/src/browserbase/types/context.py
+++ b/src/browserbase/types/context.py
@@ -14,4 +14,7 @@ class Context(BaseModel):
created_at: datetime = FieldInfo(alias="createdAt")
+ project_id: str = FieldInfo(alias="projectId")
+ """The Project ID linked to the uploaded Context."""
+
updated_at: datetime = FieldInfo(alias="updatedAt")
diff --git a/src/browserbase/types/extension.py b/src/browserbase/types/extension.py
index 018c55e..94582c3 100644
--- a/src/browserbase/types/extension.py
+++ b/src/browserbase/types/extension.py
@@ -12,11 +12,11 @@
class Extension(BaseModel):
id: str
- created_at: datetime
+ created_at: datetime = FieldInfo(alias="createdAt")
file_name: str = FieldInfo(alias="fileName")
project_id: str = FieldInfo(alias="projectId")
"""The Project ID linked to the uploaded Extension."""
- updated_at: datetime
+ updated_at: datetime = FieldInfo(alias="updatedAt")
diff --git a/src/browserbase/types/project.py b/src/browserbase/types/project.py
index cba2873..afbcef6 100644
--- a/src/browserbase/types/project.py
+++ b/src/browserbase/types/project.py
@@ -14,4 +14,10 @@ class Project(BaseModel):
created_at: datetime = FieldInfo(alias="createdAt")
+ default_timeout: int = FieldInfo(alias="defaultTimeout")
+
+ name: str
+
+ owner_id: str = FieldInfo(alias="ownerId")
+
updated_at: datetime = FieldInfo(alias="updatedAt")
diff --git a/src/browserbase/types/session.py b/src/browserbase/types/session.py
index a6803a7..8bd47f9 100644
--- a/src/browserbase/types/session.py
+++ b/src/browserbase/types/session.py
@@ -14,46 +14,35 @@
class Session(BaseModel):
id: str
- created_at: datetime
+ created_at: datetime = FieldInfo(alias="createdAt")
- expires_at: datetime
+ expires_at: datetime = FieldInfo(alias="expiresAt")
- keep_alive: bool
+ keep_alive: bool = FieldInfo(alias="keepAlive")
"""Indicates if the Session was created to be kept alive upon disconnections"""
- project_id: str
+ project_id: str = FieldInfo(alias="projectId")
"""The Project ID linked to the Session."""
- region: str
+ proxy_bytes: int = FieldInfo(alias="proxyBytes")
+ """Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)"""
+
+ region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]
+ """The region where the Session is running."""
- started_at: datetime
+ started_at: datetime = FieldInfo(alias="startedAt")
status: Literal["RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]
- updated_at: datetime
+ updated_at: datetime = FieldInfo(alias="updatedAt")
- avg_cpu_usage: Optional[int] = None
+ avg_cpu_usage: Optional[int] = FieldInfo(alias="avgCpuUsage", default=None)
"""CPU used by the Session"""
- connect_url: Optional[str] = FieldInfo(alias="connectUrl", default=None)
-
- context_id: Optional[str] = None
+ context_id: Optional[str] = FieldInfo(alias="contextId", default=None)
"""Optional. The Context linked to the Session."""
- ended_at: Optional[datetime] = None
+ ended_at: Optional[datetime] = FieldInfo(alias="endedAt", default=None)
- is_idle: Optional[bool] = None
-
- memory_usage: Optional[int] = None
+ memory_usage: Optional[int] = FieldInfo(alias="memoryUsage", default=None)
"""Memory used by the Session"""
-
- proxy_bytes: Optional[int] = None
- """Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)"""
-
- selenium_remote_url: Optional[str] = FieldInfo(alias="seleniumRemoteUrl", default=None)
-
- signing_key: Optional[str] = FieldInfo(alias="signingKey", default=None)
-
- viewport_height: Optional[int] = None
-
- viewport_width: Optional[int] = None
diff --git a/src/browserbase/types/session_create_params.py b/src/browserbase/types/session_create_params.py
index fd43187..3b1920a 100644
--- a/src/browserbase/types/session_create_params.py
+++ b/src/browserbase/types/session_create_params.py
@@ -2,8 +2,8 @@
from __future__ import annotations
-from typing import List, Union, Iterable
-from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
+from typing import List
+from typing_extensions import Literal, Required, Annotated, TypedDict
from .._utils import PropertyInfo
@@ -14,10 +14,6 @@
"BrowserSettingsFingerprint",
"BrowserSettingsFingerprintScreen",
"BrowserSettingsViewport",
- "ProxiesUnionMember1",
- "ProxiesUnionMember1BrowserbaseProxyConfig",
- "ProxiesUnionMember1BrowserbaseProxyConfigGeolocation",
- "ProxiesUnionMember1ExternalProxyConfig",
]
@@ -42,12 +38,15 @@ class SessionCreateParams(TypedDict, total=False):
This is available on the Startup plan only.
"""
- proxies: Union[bool, Iterable[ProxiesUnionMember1]]
+ proxies: object
"""Proxy configuration.
Can be true for default proxy, or an array of proxy configurations.
"""
+ region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]
+ """The region where the Session should run."""
+
api_timeout: Annotated[int, PropertyInfo(alias="timeout")]
"""Duration in seconds after which the session will automatically end.
@@ -59,7 +58,7 @@ class BrowserSettingsContext(TypedDict, total=False):
id: Required[str]
"""The Context ID."""
- persist: Required[bool]
+ persist: bool
"""Whether or not to persist the context after browsing. Defaults to `false`."""
@@ -131,56 +130,3 @@ class BrowserSettings(TypedDict, total=False):
"""Enable or disable captcha solving in the browser. Defaults to `true`."""
viewport: BrowserSettingsViewport
-
-
-class ProxiesUnionMember1BrowserbaseProxyConfigGeolocation(TypedDict, total=False):
- country: Required[str]
- """Country code in ISO 3166-1 alpha-2 format"""
-
- city: str
- """Name of the city. Use spaces for multi-word city names. Optional."""
-
- state: str
- """US state code (2 characters). Must also specify US as the country. Optional."""
-
-
-class ProxiesUnionMember1BrowserbaseProxyConfig(TypedDict, total=False):
- type: Required[Literal["browserbase"]]
- """Type of proxy.
-
- Always use 'browserbase' for the Browserbase managed proxy network.
- """
-
- domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
- """Domain pattern for which this proxy should be used.
-
- If omitted, defaults to all domains. Optional.
- """
-
- geolocation: ProxiesUnionMember1BrowserbaseProxyConfigGeolocation
- """Configuration for geolocation"""
-
-
-class ProxiesUnionMember1ExternalProxyConfig(TypedDict, total=False):
- server: Required[str]
- """Server URL for external proxy. Required."""
-
- type: Required[Literal["external"]]
- """Type of proxy. Always 'external' for this config."""
-
- domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
- """Domain pattern for which this proxy should be used.
-
- If omitted, defaults to all domains. Optional.
- """
-
- password: str
- """Password for external proxy authentication. Optional."""
-
- username: str
- """Username for external proxy authentication. Optional."""
-
-
-ProxiesUnionMember1: TypeAlias = Union[
- ProxiesUnionMember1BrowserbaseProxyConfig, ProxiesUnionMember1ExternalProxyConfig
-]
diff --git a/src/browserbase/types/session_create_response.py b/src/browserbase/types/session_create_response.py
new file mode 100644
index 0000000..8c9ae09
--- /dev/null
+++ b/src/browserbase/types/session_create_response.py
@@ -0,0 +1,57 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+
+__all__ = ["SessionCreateResponse"]
+
+
+class SessionCreateResponse(BaseModel):
+ id: str
+
+ connect_url: str = FieldInfo(alias="connectUrl")
+ """WebSocket URL to connect to the Session."""
+
+ created_at: datetime = FieldInfo(alias="createdAt")
+
+ expires_at: datetime = FieldInfo(alias="expiresAt")
+
+ keep_alive: bool = FieldInfo(alias="keepAlive")
+ """Indicates if the Session was created to be kept alive upon disconnections"""
+
+ project_id: str = FieldInfo(alias="projectId")
+ """The Project ID linked to the Session."""
+
+ proxy_bytes: int = FieldInfo(alias="proxyBytes")
+ """Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)"""
+
+ region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]
+ """The region where the Session is running."""
+
+ selenium_remote_url: str = FieldInfo(alias="seleniumRemoteUrl")
+ """HTTP URL to connect to the Session."""
+
+ signing_key: str = FieldInfo(alias="signingKey")
+ """Signing key to use when connecting to the Session via HTTP."""
+
+ started_at: datetime = FieldInfo(alias="startedAt")
+
+ status: Literal["RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]
+
+ updated_at: datetime = FieldInfo(alias="updatedAt")
+
+ avg_cpu_usage: Optional[int] = FieldInfo(alias="avgCpuUsage", default=None)
+ """CPU used by the Session"""
+
+ context_id: Optional[str] = FieldInfo(alias="contextId", default=None)
+ """Optional. The Context linked to the Session."""
+
+ ended_at: Optional[datetime] = FieldInfo(alias="endedAt", default=None)
+
+ memory_usage: Optional[int] = FieldInfo(alias="memoryUsage", default=None)
+ """Memory used by the Session"""
diff --git a/tests/api_resources/test_sessions.py b/tests/api_resources/test_sessions.py
index 40b7173..dadadd4 100644
--- a/tests/api_resources/test_sessions.py
+++ b/tests/api_resources/test_sessions.py
@@ -13,6 +13,7 @@
Session,
SessionLiveURLs,
SessionListResponse,
+ SessionCreateResponse,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -26,7 +27,7 @@ def test_method_create(self, client: Browserbase) -> None:
session = client.sessions.create(
project_id="projectId",
)
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
def test_method_create_with_all_params(self, client: Browserbase) -> None:
@@ -62,10 +63,11 @@ def test_method_create_with_all_params(self, client: Browserbase) -> None:
},
extension_id="extensionId",
keep_alive=True,
- proxies=True,
+ proxies={},
+ region="us-west-2",
api_timeout=60,
)
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
def test_raw_response_create(self, client: Browserbase) -> None:
@@ -76,7 +78,7 @@ def test_raw_response_create(self, client: Browserbase) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
session = response.parse()
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
def test_streaming_response_create(self, client: Browserbase) -> None:
@@ -87,7 +89,7 @@ def test_streaming_response_create(self, client: Browserbase) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
session = response.parse()
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -254,7 +256,7 @@ async def test_method_create(self, async_client: AsyncBrowserbase) -> None:
session = await async_client.sessions.create(
project_id="projectId",
)
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncBrowserbase) -> None:
@@ -290,10 +292,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncBrowserbas
},
extension_id="extensionId",
keep_alive=True,
- proxies=True,
+ proxies={},
+ region="us-west-2",
api_timeout=60,
)
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
async def test_raw_response_create(self, async_client: AsyncBrowserbase) -> None:
@@ -304,7 +307,7 @@ async def test_raw_response_create(self, async_client: AsyncBrowserbase) -> None
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
session = await response.parse()
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
@parametrize
async def test_streaming_response_create(self, async_client: AsyncBrowserbase) -> None:
@@ -315,7 +318,7 @@ async def test_streaming_response_create(self, async_client: AsyncBrowserbase) -
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
session = await response.parse()
- assert_matches_type(Session, session, path=["response"])
+ assert_matches_type(SessionCreateResponse, session, path=["response"])
assert cast(Any, response.is_closed) is True