Skip to content
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

release: 1.0.6 #79

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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 @@
{
".": "1.0.5"
".": "1.0.6"
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 1.0.6 (2025-01-07)

Full Changelog: [v1.0.5...v1.0.6](https://github.com/browserbase/sdk-python/compare/v1.0.5...v1.0.6)

### Chores

* add missing isclass check ([#94](https://github.com/browserbase/sdk-python/issues/94)) ([de5856d](https://github.com/browserbase/sdk-python/commit/de5856dac77567813f681615bef7d147e505a6a0))
* **internal:** add support for TypeAliasType ([#85](https://github.com/browserbase/sdk-python/issues/85)) ([64448c6](https://github.com/browserbase/sdk-python/commit/64448c6e020aaeb4b39b7ec8f1b28a6b8f0c746a))
* **internal:** bump pydantic dependency ([#81](https://github.com/browserbase/sdk-python/issues/81)) ([e35a0d8](https://github.com/browserbase/sdk-python/commit/e35a0d85ef0e45aed1a5f58757427bf7c16a76f5))
* **internal:** bump pyright ([#83](https://github.com/browserbase/sdk-python/issues/83)) ([894b4c4](https://github.com/browserbase/sdk-python/commit/894b4c45b0c36963822923535391aa34dbfec766))
* **internal:** codegen related update ([#86](https://github.com/browserbase/sdk-python/issues/86)) ([ab76578](https://github.com/browserbase/sdk-python/commit/ab76578bdce5eba2410b09f497758fbf0e0d8cf0))
* **internal:** codegen related update ([#87](https://github.com/browserbase/sdk-python/issues/87)) ([f7f189e](https://github.com/browserbase/sdk-python/commit/f7f189ec317394f2fc532b8f95c3d15304298027))
* **internal:** codegen related update ([#88](https://github.com/browserbase/sdk-python/issues/88)) ([85f1492](https://github.com/browserbase/sdk-python/commit/85f1492efc58d86ebc34511ca1269a0db2a4d223))
* **internal:** codegen related update ([#93](https://github.com/browserbase/sdk-python/issues/93)) ([57f0977](https://github.com/browserbase/sdk-python/commit/57f0977c8e050b85b2c2de91202f6775299f80bf))
* **internal:** fix some typos ([#92](https://github.com/browserbase/sdk-python/issues/92)) ([51d9f42](https://github.com/browserbase/sdk-python/commit/51d9f42a32d17d2d2277eb8a7b8f35a980c7c485))
* **internal:** remove some duplicated imports ([#89](https://github.com/browserbase/sdk-python/issues/89)) ([a82ae7d](https://github.com/browserbase/sdk-python/commit/a82ae7d418b1daf68c85e70dea61e628eb785b79))
* **internal:** updated imports ([#90](https://github.com/browserbase/sdk-python/issues/90)) ([dc6e187](https://github.com/browserbase/sdk-python/commit/dc6e187bfe9585692b2de1b67fc83f027a52c43c))
* make the `Omit` type public ([#78](https://github.com/browserbase/sdk-python/issues/78)) ([a7bdc57](https://github.com/browserbase/sdk-python/commit/a7bdc57ab7f327da61121986ba7b006238d0e5b5))


### Documentation

* **readme:** example snippet for client context manager ([#91](https://github.com/browserbase/sdk-python/issues/91)) ([950c8af](https://github.com/browserbase/sdk-python/commit/950c8af19db4581fabd5b965ca4f0af3cc5cd6dc))
* **readme:** fix http client proxies example ([#82](https://github.com/browserbase/sdk-python/issues/82)) ([cc67c77](https://github.com/browserbase/sdk-python/commit/cc67c773b11b42b406b677f466c7c0ef090b254e))

## 1.0.5 (2024-12-03)

Full Changelog: [v1.0.4...v1.0.5](https://github.com/browserbase/sdk-python/compare/v1.0.4...v1.0.5)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Browserbase
Copyright 2025 Browserbase

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ session = client.sessions.create(
)
print(session.id)


def run(playwright: Playwright) -> None:
# Connect to the remote session
chromium = playwright.chromium
Expand All @@ -51,9 +52,7 @@ def run(playwright: Playwright) -> None:
# Execute Playwright actions on the remote browser tab
page.goto("https://news.ycombinator.com/")
page_title = page.title()
assert (
page_title == "Hacker News"
), f"Page title is not 'Hacker News', it is '{page_title}'"
assert page_title == "Hacker News", f"Page title is not 'Hacker News', it is '{page_title}'"
page.screenshot(path="screenshot.png")

page.close()
Expand Down Expand Up @@ -290,18 +289,19 @@ can also get all the extra fields on the Pydantic model as a dict with

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

- Support for proxies
- Custom transports
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
import httpx
from browserbase import Browserbase, DefaultHttpxClient

client = Browserbase(
# Or use the `BROWSERBASE_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Expand All @@ -317,6 +317,16 @@ client.with_options(http_client=DefaultHttpxClient(...))

By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.

```py
from browserbase import Browserbase

with Browserbase() as client:
# make requests here
...

# HTTP client is now closed
```

## Versioning

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
Expand Down
1 change: 1 addition & 0 deletions examples/e2e/test_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def playwright() -> Generator[Playwright, None, None]:
with sync_playwright() as p:
yield p


def test_playwright_basic(playwright: Playwright) -> None:
playwright_basic.run(playwright)

Expand Down
4 changes: 1 addition & 3 deletions examples/playwright_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def run(playwright: Playwright) -> None:
# Execute Playwright actions on the remote browser tab
page.goto("https://news.ycombinator.com/")
page_title = page.title()
assert (
page_title == "Hacker News"
), f"Page title is not 'Hacker News', it is '{page_title}'"
assert page_title == "Hacker News", f"Page title is not 'Hacker News', it is '{page_title}'"
page.screenshot(path="screenshot.png")

page.close()
Expand Down
4 changes: 1 addition & 3 deletions examples/playwright_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def handle_console(msg: ConsoleMessage) -> None:
page.on("console", handle_console)

page.goto(DEFAULT_CAPTCHA_URL, wait_until="networkidle")
page.wait_for_function(
"() => window.captchaSolvingFinished === true", timeout=OVERRIDE_TIMEOUT
)
page.wait_for_function("() => window.captchaSolvingFinished === true", timeout=OVERRIDE_TIMEOUT)

assert captcha_solving_started, "Captcha solving did not start"
assert captcha_solving_finished, "Captcha solving did not finish"
Expand Down
16 changes: 4 additions & 12 deletions examples/playwright_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ def run(playwright: Playwright) -> None:
# Step 2: Creates a session with the context
session = bb.sessions.create(
project_id=BROWSERBASE_PROJECT_ID,
browser_settings=TypeAdapter(BrowserSettings).validate_python(
{"context": {"id": context_id, "persist": True}}
),
browser_settings=TypeAdapter(BrowserSettings).validate_python({"context": {"id": context_id, "persist": True}}),
)
print(session)

assert (
session.context_id == context_id
), f"Session context_id is {session.context_id}, expected {context_id}"
assert session.context_id == context_id, f"Session context_id is {session.context_id}, expected {context_id}"
session_id = session.id

# Step 3: Populates and persists the context
Expand Down Expand Up @@ -90,13 +86,9 @@ def run(playwright: Playwright) -> None:
# Step 4: Creates another session with the same context
session = bb.sessions.create(
project_id=BROWSERBASE_PROJECT_ID,
browser_settings=BrowserSettings(
context=BrowserSettingsContext(id=context_id, persist=True)
),
browser_settings=BrowserSettings(context=BrowserSettingsContext(id=context_id, persist=True)),
)
assert (
session.context_id == context_id
), f"Session context_id is {session.context_id}, expected {context_id}"
assert session.context_id == context_id, f"Session context_id is {session.context_id}, expected {context_id}"
session_id = session.id

# Step 5: Uses context to find previous state
Expand Down
20 changes: 5 additions & 15 deletions examples/playwright_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
)
from browserbase.types import Extension, SessionCreateResponse

PATH_TO_EXTENSION = (
Path.cwd() / "examples" / "packages" / "extensions" / "browserbase-test"
)
PATH_TO_EXTENSION = Path.cwd() / "examples" / "packages" / "extensions" / "browserbase-test"


def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> BytesIO:
Expand All @@ -23,9 +21,7 @@ def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> B
Mark save_local=True to save the zip file to a local file.
"""
# Ensure we're looking at an extension
assert "manifest.json" in os.listdir(
path
), "No manifest.json found in the extension folder."
assert "manifest.json" in os.listdir(path), "No manifest.json found in the extension folder."

# Create a BytesIO object to hold the zip file in memory
memory_zip = BytesIO()
Expand All @@ -51,9 +47,7 @@ def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> B

def create_extension() -> str:
zip_data = zip_extension(save_local=True)
extension: Extension = bb.extensions.create(
file=("extension.zip", zip_data.getvalue())
)
extension: Extension = bb.extensions.create(file=("extension.zip", zip_data.getvalue()))
return extension.id


Expand All @@ -75,9 +69,7 @@ def check_for_message(page: Page, message: str) -> None:
while time.time() - start < 10:
if message in console_messages:
break
assert (
message in console_messages
), f"Expected message not found in console logs. Messages: {console_messages}"
assert message in console_messages, f"Expected message not found in console logs. Messages: {console_messages}"


def run(playwright: Playwright) -> None:
Expand Down Expand Up @@ -141,9 +133,7 @@ def run(playwright: Playwright) -> None:
project_id=BROWSERBASE_PROJECT_ID,
extension_id=extension_id,
)
raise AssertionError(
"Expected to fail when creating session with deleted extension"
)
raise AssertionError("Expected to fail when creating session with deleted extension")
except Exception as e:
print(f"Failed to create session with deleted extension as expected: {str(e)}")

Expand Down
4 changes: 1 addition & 3 deletions examples/playwright_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@


def check_proxy_bytes(session_id: str) -> None:
bb.sessions.update(
id=session_id, project_id=BROWSERBASE_PROJECT_ID, status="REQUEST_RELEASE"
)
bb.sessions.update(id=session_id, project_id=BROWSERBASE_PROJECT_ID, status="REQUEST_RELEASE")
time.sleep(GRACEFUL_SHUTDOWN_TIMEOUT / 1000)
updated_session = bb.sessions.retrieve(id=session_id)
assert (
Expand Down
8 changes: 2 additions & 6 deletions examples/playwright_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ def run(playwright: Playwright) -> None:
file_size = int(file_size_span.inner_text())

# Assert the file name and size
assert (
file_name == "logo.png"
), f"Expected file name to be 'logo.png', but got '{file_name}'"
assert (
file_size > 0
), f"Expected file size to be greater than 0, but got {file_size}"
assert file_name == "logo.png", f"Expected file name to be 'logo.png', but got '{file_name}'"
assert file_size > 0, f"Expected file size to be greater than 0, but got {file_size}"

print("File upload test passed successfully!")

Expand Down
3 changes: 2 additions & 1 deletion examples/selenium_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def run() -> None:
session = bb.sessions.create(project_id=BROWSERBASE_PROJECT_ID)
connection = BrowserbaseConnection(session.id, session.selenium_remote_url)
driver = webdriver.Remote(
command_executor=connection, options=webdriver.ChromeOptions() # type: ignore
command_executor=connection,
options=webdriver.ChromeOptions(), # type: ignore
)

# Print a bit of info about the browser we've connected to
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "browserbase"
version = "1.0.5"
version = "1.0.6"
description = "The official Python library for the Browserbase API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -10,7 +10,7 @@ authors = [
dependencies = [
"httpx>=0.23.0, <1",
"pydantic>=1.9.0, <3",
"typing-extensions>=4.7, <5",
"typing-extensions>=4.10, <5",
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
Expand Down
8 changes: 4 additions & 4 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# all-features: true
# with-sources: false
# generate-hashes: false
# universal: false
Expand Down Expand Up @@ -81,15 +81,15 @@ playwright==1.48.0
# via pytest-playwright
pluggy==1.5.0
# via pytest
pydantic==2.9.2
pydantic==2.10.3
# via browserbase
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
pyee==12.0.0
# via playwright
pygments==2.18.0
# via rich
pyright==1.1.386
pyright==1.1.390
pysocks==1.7.1
# via urllib3
pytest==8.3.3
Expand Down
4 changes: 2 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
pydantic==2.9.2
pydantic==2.10.3
# via browserbase
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
sniffio==1.3.0
# via anyio
Expand Down
3 changes: 2 additions & 1 deletion src/browserbase/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from . import types
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import (
Client,
Expand Down Expand Up @@ -46,6 +46,7 @@
"ProxiesTypes",
"NotGiven",
"NOT_GIVEN",
"Omit",
"BrowserbaseError",
"APIError",
"APIStatusError",
Expand Down
Loading
Loading