Skip to content

release: 0.1.0-alpha.4 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.3"
".": "0.1.0-alpha.4"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Methods:
Types:

```python
from browserbase.types import Session, SessionLiveURLs, SessionListResponse
from browserbase.types import Session, SessionLiveURLs, SessionCreateResponse, SessionListResponse
```

Methods:

- <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>
- <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>
- <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>
- <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>
- <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>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/browserbase/_version.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/browserbase/resources/sessions/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
22 changes: 15 additions & 7 deletions src/browserbase/resources/sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

from typing import Union, Iterable
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -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"]

Expand Down Expand Up @@ -104,15 +104,16 @@ 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Session:
) -> SessionCreateResponse:
"""Create a Session

Args:
Expand All @@ -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`.

Expand All @@ -150,14 +153,15 @@ def create(
"extension_id": extension_id,
"keep_alive": keep_alive,
"proxies": proxies,
"region": region,
"timeout": api_timeout,
},
session_create_params.SessionCreateParams,
),
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(
Expand Down Expand Up @@ -354,15 +358,16 @@ 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.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Session:
) -> SessionCreateResponse:
"""Create a Session

Args:
Expand All @@ -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`.

Expand All @@ -400,14 +407,15 @@ async def create(
"extension_id": extension_id,
"keep_alive": keep_alive,
"proxies": proxies,
"region": region,
"timeout": api_timeout,
},
session_create_params.SessionCreateParams,
),
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(
Expand Down
1 change: 1 addition & 0 deletions src/browserbase/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions src/browserbase/types/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions src/browserbase/types/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
6 changes: 6 additions & 0 deletions src/browserbase/types/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
41 changes: 15 additions & 26 deletions src/browserbase/types/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
68 changes: 7 additions & 61 deletions src/browserbase/types/session_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,10 +14,6 @@
"BrowserSettingsFingerprint",
"BrowserSettingsFingerprintScreen",
"BrowserSettingsViewport",
"ProxiesUnionMember1",
"ProxiesUnionMember1BrowserbaseProxyConfig",
"ProxiesUnionMember1BrowserbaseProxyConfigGeolocation",
"ProxiesUnionMember1ExternalProxyConfig",
]


Expand All @@ -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.

Expand All @@ -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`."""


Expand Down Expand Up @@ -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
]
Loading
Loading