Python SDK for BrowserBase Stagehand
Project description
Stagehand Python SDK
A Python SDK for BrowserBase Stagehand, enabling automated browser control and data extraction.
Installation
pip install stagehand-sdk
Usage
import asyncio
from stagehand import Stagehand
async def main():
# Initialize the Stagehand client
browser = Stagehand(
env="BROWSERBASE",
api_key="your-api-key",
project_id="your-project-id"
)
# Perform browser actions
result = await browser.act("Navigate to google.com")
# Extract data using a schema
data = await browser.extract("Get the search results", {
"results": [{"title": "string", "url": "string"}]
})
# Close the browser
await browser.close()
# Run the example
asyncio.run(main())
Configuration
env: Environment to use (default: "BROWSERBASE")api_key: Your BrowserBase API key (can also be set via BROWSERBASE_API_KEY environment variable)project_id: Your BrowserBase project ID (can also be set via BROWSERBASE_PROJECT_ID environment variable)verbose: Verbosity level (default: 0)
Features
- Automated browser control with natural language commands
- Data extraction with schema validation
- Async/await support
- Automatic NextJS server management
Requirements
- Python 3.7+
- httpx
- asyncio
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stagehand_py-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stagehand_py-0.1.0.tar.gz.
File metadata
- Download URL: stagehand_py-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c305763842ba72e0459b4c229c80050b895fd29e66bd9d574fee862a6e80ef
|
|
| MD5 |
e411978a1c7dd2f63befd648334ed92e
|
|
| BLAKE2b-256 |
9edd7f618b6028353a9e51e7372c68895b5bd9cc18ee857053b053522785338c
|
File details
Details for the file stagehand_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stagehand_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6d0bf05b11ab4eb0768bf0c379a05501d224558f1d8f80827e1c934d698ba96
|
|
| MD5 |
c20eebd0ef7e4895e28391522a744843
|
|
| BLAKE2b-256 |
5faf318ca58d072c2f8ad6c753ad0f85c75bb4de232da8176c597ecb910e85be
|