Python SDK for Stagehand
Project description
Stagehand Python SDK
A Python SDK for BrowserBase Stagehand, enabling automated browser control and data extraction.
Installation
pip install stagehand-py
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.2.tar.gz
(5.8 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.2.tar.gz.
File metadata
- Download URL: stagehand_py-0.1.2.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105e5892e7d517a7b37b5c74dd9b4313fdfbadd87ebd2499227226d8281d88f2
|
|
| MD5 |
6514ef8877585a795df767696c478821
|
|
| BLAKE2b-256 |
07d4c31f6194b46d64f95b169231ad2a2d8282358fe6ee9a329d7a40d5f59088
|
File details
Details for the file stagehand_py-0.1.2-py3-none-any.whl.
File metadata
- Download URL: stagehand_py-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.7 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 |
ef4fde22d13f8fe9fa8e3823b1d0a8cbf4d3e6c5d0aa40a5a6450fcf1a87029b
|
|
| MD5 |
1c6d044517965511c0a128474794e98d
|
|
| BLAKE2b-256 |
ddd09b4793aa3683e616de2324f3118080f33a9436b5194ffe4577efad2a4081
|