browsernative
Python client for the Browser Native web scraping API
Lightweight client for scraping, screenshots, and AI analysis via the Browser Native API. Single dependency (requests).
Install
pip install browsernative
Get an API key at bnca.monostate.ai.
Usage
from browsernative import BrowserNativeClient
client = BrowserNativeClient('your-api-key')
# Scrape
result = client.scrape('https://example.com')
# Force a specific scraping method
result = client.scrape('https://example.com', method='lightpanda')
# Screenshot
screenshot = client.screenshot('https://example.com')
# Quick screenshot (faster, no content extraction)
quick = client.quickshot('https://example.com')
# AI Q&A
answer = client.analyze('https://example.com', 'What is this site about?')
Convenience functions
from browsernative import quick_scrape, quick_shot, quick_analyze, bulk_scrape
content = quick_scrape('https://example.com', 'your-api-key')
shot = quick_shot('https://example.com', 'your-api-key')
answer = quick_analyze('https://example.com', 'What is this?', 'your-api-key')
Bulk scraping
urls = ['https://site1.com', 'https://site2.com', 'https://site3.com']
result = client.bulk_scrape(
urls,
concurrency=5,
continue_on_error=True,
progress_callback=lambda p: print(f"{p['percentage']:.1f}%"),
)
print(f"{result['stats']['successful']}/{result['stats']['total']} succeeded")
Context manager
with BrowserNativeClient('your-api-key') as client:
result = client.scrape('https://example.com')
# Session closed automatically
API Reference
Client options
client = BrowserNativeClient(
api_key='your-api-key',
base_url='https://bnca-api.fly.dev', # API endpoint
timeout=30, # Seconds
retries=2, # Retry attempts
verbose=False, # Debug logging
)
Methods
| Method | Description |
|---|---|
scrape(url, **opts) |
Extract structured content |
screenshot(url, **opts) |
Screenshot with content extraction |
quickshot(url, **opts) |
Fast screenshot only |
analyze(url, question, **opts) |
AI-powered Q&A |
bulk_scrape(urls, **opts) |
Scrape multiple URLs concurrently |
get_usage(days=30) |
Account usage statistics |
health_check() |
API health status |
Scrape options
Pass as keyword arguments:
method--'auto','direct','lightpanda', or'puppeteer'include_screenshot-- Include screenshot in responsewait_for_selector-- CSS selector to wait foruser_agent-- Custom user agent
Response shape
{
'success': True,
'data': { 'title': ..., 'content': ..., ... },
'responseTime': 1234,
'attempt': 1,
}
Browser sessions
Persistent browser sessions with real-time control over WebSocket:
session = client.create_session(mode='auto')
session.goto('https://example.com')
session.click('#login')
session.type('#email', 'user@example.com')
state = session.get_page_state(includeScreenshot=True)
session.screenshot()
# Listen for backend fallback events
session.on('fallback', lambda e: print(f"{e['from']} -> {e['to']}: {e['reason']}"))
session.close()
Modes: auto (LightPanda + Chrome fallback), headless, visual, computer-use.
Computer use mode
For AI agents that control the browser by pixel coordinates:
session = client.create_session(mode='computer-use', screen_width=1280, screen_height=800)
session.goto('https://example.com')
session.click_at(640, 400)
session.type_text('hello world')
session.mouse_move(100, 200)
session.drag(10, 20, 300, 400)
session.scroll_at(640, 400, 'down', 5)
pos = session.get_cursor_position()
size = session.get_screen_size()
screenshot = session.screenshot()
# VNC streaming URL
print(session.vnc_url)
session.close()
Requires websocket-client: pip install websocket-client
Requirements
- Python 3.9+
requests(installed automatically)websocket-client(for browser sessions)
Changelog
See CHANGELOG.md.
License
MIT
Metadata
Release files for browsernative 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| browsernative-2.2.0.tar.gz | 17.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| browsernative-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.5 kB
Release files / browsernative-2.2.0.tar.gz
| Download URL | browsernative-2.2.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca1d068123bb75016c8d443938bf393d0527b16033156d0618daa08cdc010518
|
|
BLAKE2b-256 checksum How to use checksums |
85fef7708c7b218c1e713ba9a3bfb41f539e2341b4522dbc85d603f9e09bdac2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / browsernative-2.2.0-py3-none-any.whl
| Download URL | browsernative-2.2.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f453a47a0257674e0bd53ad4d60b906472cf5fd22d5b8a78f91a6f2c03c339c1
|
|
BLAKE2b-256 checksum How to use checksums |
bb61361af00e2803cab5cc072bca11969593ee1665456d41a1e83e8912525721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for browsernative 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.