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_sdk-0.1.0.tar.gz
(3.1 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_sdk-0.1.0.tar.gz.
File metadata
- Download URL: stagehand_sdk-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e3631b089170a2e3c8309a0d68202449415be449b6b93c428b60ac9b4ed22bc
|
|
| MD5 |
8bb16ee1c8ad0c6929beba9a50af4922
|
|
| BLAKE2b-256 |
a0a49ce518ad74e02952301696d1a39bc45a34b5babc0820e24ffb2454f581dd
|
File details
Details for the file stagehand_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stagehand_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 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 |
ef88542bac541f0f295a1cb277bea4c7b285d0ad4503cd7e98fd38e7c8a7de79
|
|
| MD5 |
f0601fee4faf972610ee7036b582cd74
|
|
| BLAKE2b-256 |
6e18ef04534d2329b5a4ffdc9f1826c249411e89c2c921feab1fc4a4483cba20
|