From de118e2fb0e958a7374d1015beae604fceb732ff Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 29 Oct 2024 01:04:07 +0000 Subject: [PATCH 1/4] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e5f4ae3..26fe273 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-9f93c744538f57747ea1385817e21b40c318b65ebc155dca8950268beb280bc9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-873c7106986f864ce293afcccbe32239bc102bb7c1d27acfeafaca3b3e819ee3.yml From 8c98d9e9da61daba527262aa1b0a1334da22a596 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 04:43:09 +0000 Subject: [PATCH 2/4] feat(api): api update (#39) --- .stats.yml | 2 +- .../resources/sessions/sessions.py | 5 +- .../types/session_create_params.py | 63 ++++++++++++++++++- tests/api_resources/test_sessions.py | 4 +- 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 26fe273..1a6b2b5 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-873c7106986f864ce293afcccbe32239bc102bb7c1d27acfeafaca3b3e819ee3.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-b341dd9d5bb77c4f217b94b186763e730fd798fbb773a5e90bb4e2a8d4a2c822.yml diff --git a/src/browserbase/resources/sessions/sessions.py b/src/browserbase/resources/sessions/sessions.py index 74a99bb..fc4cac3 100644 --- a/src/browserbase/resources/sessions/sessions.py +++ b/src/browserbase/resources/sessions/sessions.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Union, Iterable from typing_extensions import Literal import httpx @@ -104,7 +105,7 @@ def create( browser_settings: session_create_params.BrowserSettings | NotGiven = NOT_GIVEN, extension_id: str | NotGiven = NOT_GIVEN, keep_alive: bool | NotGiven = NOT_GIVEN, - proxies: object | NotGiven = NOT_GIVEN, + proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | 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. @@ -358,7 +359,7 @@ 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: object | NotGiven = NOT_GIVEN, + proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | 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. diff --git a/src/browserbase/types/session_create_params.py b/src/browserbase/types/session_create_params.py index 3b1920a..bd643b3 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 -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict from .._utils import PropertyInfo @@ -14,6 +14,10 @@ "BrowserSettingsFingerprint", "BrowserSettingsFingerprintScreen", "BrowserSettingsViewport", + "ProxiesUnionMember1", + "ProxiesUnionMember1BrowserbaseProxyConfig", + "ProxiesUnionMember1BrowserbaseProxyConfigGeolocation", + "ProxiesUnionMember1ExternalProxyConfig", ] @@ -38,7 +42,7 @@ class SessionCreateParams(TypedDict, total=False): This is available on the Startup plan only. """ - proxies: object + proxies: Union[bool, Iterable[ProxiesUnionMember1]] """Proxy configuration. Can be true for default proxy, or an array of proxy configurations. @@ -130,3 +134,56 @@ 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/tests/api_resources/test_sessions.py b/tests/api_resources/test_sessions.py index dadadd4..8ebd5da 100644 --- a/tests/api_resources/test_sessions.py +++ b/tests/api_resources/test_sessions.py @@ -63,7 +63,7 @@ def test_method_create_with_all_params(self, client: Browserbase) -> None: }, extension_id="extensionId", keep_alive=True, - proxies={}, + proxies=True, region="us-west-2", api_timeout=60, ) @@ -292,7 +292,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncBrowserbas }, extension_id="extensionId", keep_alive=True, - proxies={}, + proxies=True, region="us-west-2", api_timeout=60, ) From 0557ee507fc35faa9aabd8d06ce8047bb07843aa Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 29 Oct 2024 05:15:10 +0000 Subject: [PATCH 3/4] feat(api): api update (#41) --- README.md | 6 ------ tests/test_client.py | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 72bc5a3..6969052 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ bb = Browserbase( session = client.sessions.create( project_id=BROWSERBASE_PROJECT_ID, - proxies=True, ) print(session.id) @@ -113,7 +112,6 @@ client = Browserbase() try: client.sessions.create( project_id="your_project_id", - proxies=True, ) except browserbase.APIConnectionError as e: print("The server could not be reached") @@ -159,7 +157,6 @@ client = Browserbase( # Or, configure per-request: client.with_options(max_retries=5).sessions.create( project_id="your_project_id", - proxies=True, ) ``` @@ -185,7 +182,6 @@ client = Browserbase( # Override per-request: client.with_options(timeout=5.0).sessions.create( project_id="your_project_id", - proxies=True, ) ``` @@ -227,7 +223,6 @@ from browserbase import Browserbase client = Browserbase() response = client.sessions.with_raw_response.create( project_id="your_project_id", - proxies=True, ) print(response.headers.get('X-My-Header')) @@ -248,7 +243,6 @@ To stream the response body, use `.with_streaming_response` instead, which requi ```python with client.sessions.with_streaming_response.create( project_id="your_project_id", - proxies=True, ) as response: print(response.headers.get("X-My-Header")) diff --git a/tests/test_client.py b/tests/test_client.py index 9679e17..c70ef50 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -723,7 +723,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No with pytest.raises(APITimeoutError): self.client.post( "/v1/sessions", - body=cast(object, dict(project_id="your_project_id", proxies=True)), + body=cast(object, dict(project_id="your_project_id")), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -738,7 +738,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non with pytest.raises(APIStatusError): self.client.post( "/v1/sessions", - body=cast(object, dict(project_id="your_project_id", proxies=True)), + body=cast(object, dict(project_id="your_project_id")), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -1503,7 +1503,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) with pytest.raises(APITimeoutError): await self.client.post( "/v1/sessions", - body=cast(object, dict(project_id="your_project_id", proxies=True)), + body=cast(object, dict(project_id="your_project_id")), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) @@ -1518,7 +1518,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) with pytest.raises(APIStatusError): await self.client.post( "/v1/sessions", - body=cast(object, dict(project_id="your_project_id", proxies=True)), + body=cast(object, dict(project_id="your_project_id")), cast_to=httpx.Response, options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, ) From ec7b6c461ca1f5f188c8358f35781181642f9bc6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 05:16:20 +0000 Subject: [PATCH 4/4] release: 1.0.0-alpha.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/browserbase/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b5db7ce..f0b371d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.7" + ".": "1.0.0-alpha.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f53046..810279a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.0.0-alpha.0 (2024-10-29) + +Full Changelog: [v0.1.0-alpha.7...v1.0.0-alpha.0](https://github.com/browserbase/sdk-python/compare/v0.1.0-alpha.7...v1.0.0-alpha.0) + +### Features + +* **api:** api update ([#39](https://github.com/browserbase/sdk-python/issues/39)) ([8c98d9e](https://github.com/browserbase/sdk-python/commit/8c98d9e9da61daba527262aa1b0a1334da22a596)) +* **api:** api update ([#41](https://github.com/browserbase/sdk-python/issues/41)) ([0557ee5](https://github.com/browserbase/sdk-python/commit/0557ee507fc35faa9aabd8d06ce8047bb07843aa)) + ## 0.1.0-alpha.7 (2024-10-28) Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/browserbase/sdk-python/compare/v0.1.0-alpha.6...v0.1.0-alpha.7) diff --git a/pyproject.toml b/pyproject.toml index 0ed3bd7..e2305f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "browserbase" -version = "0.1.0-alpha.7" +version = "1.0.0-alpha.0" 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 382ba40..596462f 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.7" # x-release-please-version +__version__ = "1.0.0-alpha.0" # x-release-please-version