browsa 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- browsa-0.1.1/LICENSE +21 -0
- browsa-0.1.1/PKG-INFO +160 -0
- browsa-0.1.1/README.md +130 -0
- browsa-0.1.1/browsa/__init__.py +63 -0
- browsa-0.1.1/browsa/client.py +752 -0
- browsa-0.1.1/browsa/errors.py +100 -0
- browsa-0.1.1/browsa/types.py +111 -0
- browsa-0.1.1/browsa/webhooks.py +103 -0
- browsa-0.1.1/browsa.egg-info/PKG-INFO +160 -0
- browsa-0.1.1/browsa.egg-info/SOURCES.txt +15 -0
- browsa-0.1.1/browsa.egg-info/dependency_links.txt +1 -0
- browsa-0.1.1/browsa.egg-info/requires.txt +5 -0
- browsa-0.1.1/browsa.egg-info/top_level.txt +1 -0
- browsa-0.1.1/pyproject.toml +39 -0
- browsa-0.1.1/setup.cfg +4 -0
- browsa-0.1.1/tests/test_live.py +56 -0
- browsa-0.1.1/tests/test_unit.py +124 -0
browsa-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 neout
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
browsa-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: browsa
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Official Python SDK for Browsa — anti-detect cloud browsers for AI agents (browsa.io)
|
|
5
|
+
Author-email: Browsa <support@browsa.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://browsa.io
|
|
8
|
+
Project-URL: Documentation, https://browsa.io/docs
|
|
9
|
+
Project-URL: Source, https://pypi.org/project/browsa/
|
|
10
|
+
Project-URL: Issues, https://browsa.io/docs
|
|
11
|
+
Keywords: browser-automation,ai-agents,browser-use,anti-detect,captcha-solver,scraping,playwright
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# browsa (Python)
|
|
32
|
+
|
|
33
|
+
Anti-detect browsers for AI agents — official Python SDK for [browsa.io](https://browsa.io).
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/browsa/)
|
|
36
|
+
[](https://pypi.org/project/browsa/)
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install browsa
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Zero dependencies. Pure stdlib. Single-file wheel.
|
|
45
|
+
|
|
46
|
+
## Five-line hello world
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from browsa import Client
|
|
50
|
+
|
|
51
|
+
c = Client(api_key="agt_live_...")
|
|
52
|
+
job = c.run_task(
|
|
53
|
+
task="Go to news.ycombinator.com and return the top story title.",
|
|
54
|
+
llm="claude-opus-4-7",
|
|
55
|
+
llm_api_key="sk-ant-...",
|
|
56
|
+
)
|
|
57
|
+
print(job.final_result)
|
|
58
|
+
print("watch live:", job.live_url)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
That runs a real Chromium fork (Phantom — our anti-detect browser) inside an isolated burner session, driven by [browser-use](https://browser-use.com) + Claude Opus. The agent navigates, extracts, and returns. A live noVNC stream URL is available the moment the burner spawns.
|
|
62
|
+
|
|
63
|
+
## Async
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import asyncio
|
|
67
|
+
from browsa import AsyncClient
|
|
68
|
+
|
|
69
|
+
async def main():
|
|
70
|
+
async with AsyncClient(api_key="agt_live_...") as c:
|
|
71
|
+
job = await c.run_task(
|
|
72
|
+
task="Scrape the top 5 products on producthunt.com today.",
|
|
73
|
+
llm="claude-opus-4-7",
|
|
74
|
+
llm_api_key="sk-ant-...",
|
|
75
|
+
country="US",
|
|
76
|
+
)
|
|
77
|
+
print(job.final_result)
|
|
78
|
+
|
|
79
|
+
asyncio.run(main())
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Webhooks
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from browsa import webhooks
|
|
86
|
+
|
|
87
|
+
# In your receiver (Flask/FastAPI/whatever):
|
|
88
|
+
ok = webhooks.verify_signature(
|
|
89
|
+
body=raw_request_body,
|
|
90
|
+
header=request.headers["X-Agents-Signature"],
|
|
91
|
+
secret=os.environ["BROWSA_WEBHOOK_SECRET"], # hex-encoded
|
|
92
|
+
)
|
|
93
|
+
if not ok:
|
|
94
|
+
return 401
|
|
95
|
+
# Trust the payload only after this point.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## What you get
|
|
99
|
+
|
|
100
|
+
| Capability | Notes |
|
|
101
|
+
|---|---|
|
|
102
|
+
| Sync + async clients | `Client` + `AsyncClient`, same surface |
|
|
103
|
+
| Real `Job` envelope | Typed dataclass + `.raw` escape hatch |
|
|
104
|
+
| Long-poll waits | `wait_for_job(timeout=...)` uses server-side `?wait=30` |
|
|
105
|
+
| Webhook signature verify | HMAC-SHA256, constant-time compare, skew check |
|
|
106
|
+
| Canonical error envelope | `AuthError`, `InvalidIDError`, `RateLimitError`, etc. |
|
|
107
|
+
| `X-Request-Id` propagation | Every error carries the server's request id |
|
|
108
|
+
| Zero deps | Single wheel, audit-friendly, no transitive surface |
|
|
109
|
+
|
|
110
|
+
## Advanced
|
|
111
|
+
|
|
112
|
+
### Long-running tasks with progress callback
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
def show(job):
|
|
116
|
+
print(f" step {job.step_count}/{job.progress_total} status={job.status}")
|
|
117
|
+
|
|
118
|
+
job = c.run_task(
|
|
119
|
+
task="Open-ended research: scrape arxiv for papers on test-time compute, return top 10 by citation.",
|
|
120
|
+
llm="claude-opus-4-7",
|
|
121
|
+
llm_api_key="sk-ant-...",
|
|
122
|
+
max_steps=80,
|
|
123
|
+
on_progress=show,
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Interactive (input_required) tasks
|
|
128
|
+
|
|
129
|
+
If your task can pause for human input (captcha, decision point), watch for status `input_required` and respond:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
job = c.create_task(task="...", llm="...", llm_api_key="...")
|
|
133
|
+
while not job.is_terminal:
|
|
134
|
+
job = c.get_job(job.id, wait=30)
|
|
135
|
+
if job.status == "input_required":
|
|
136
|
+
answer = input(f"Agent asks: {job.input_question}\n> ")
|
|
137
|
+
job = c.respond_to_job(job.id, answer)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### JA3-spoofed sessions
|
|
141
|
+
|
|
142
|
+
Some sites fingerprint TLS handshake shape. Set a profile to spoof macOS Chrome:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
job = c.run_task(
|
|
146
|
+
task="Go to a TLS-fingerprint-fingerprinted site",
|
|
147
|
+
llm="claude-opus-4-7", llm_api_key="sk-...",
|
|
148
|
+
ja3_profile="macos_chrome_137", # uses utls
|
|
149
|
+
)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Docs
|
|
153
|
+
|
|
154
|
+
- API reference: <https://browsa.io/docs>
|
|
155
|
+
- Source: <https://github.com/mohasaaid/neout/tree/main/sdks/browsa-python>
|
|
156
|
+
- Issues: <https://github.com/mohasaaid/neout/issues>
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT.
|
browsa-0.1.1/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# browsa (Python)
|
|
2
|
+
|
|
3
|
+
Anti-detect browsers for AI agents — official Python SDK for [browsa.io](https://browsa.io).
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/browsa/)
|
|
6
|
+
[](https://pypi.org/project/browsa/)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install browsa
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Zero dependencies. Pure stdlib. Single-file wheel.
|
|
15
|
+
|
|
16
|
+
## Five-line hello world
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from browsa import Client
|
|
20
|
+
|
|
21
|
+
c = Client(api_key="agt_live_...")
|
|
22
|
+
job = c.run_task(
|
|
23
|
+
task="Go to news.ycombinator.com and return the top story title.",
|
|
24
|
+
llm="claude-opus-4-7",
|
|
25
|
+
llm_api_key="sk-ant-...",
|
|
26
|
+
)
|
|
27
|
+
print(job.final_result)
|
|
28
|
+
print("watch live:", job.live_url)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That runs a real Chromium fork (Phantom — our anti-detect browser) inside an isolated burner session, driven by [browser-use](https://browser-use.com) + Claude Opus. The agent navigates, extracts, and returns. A live noVNC stream URL is available the moment the burner spawns.
|
|
32
|
+
|
|
33
|
+
## Async
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import asyncio
|
|
37
|
+
from browsa import AsyncClient
|
|
38
|
+
|
|
39
|
+
async def main():
|
|
40
|
+
async with AsyncClient(api_key="agt_live_...") as c:
|
|
41
|
+
job = await c.run_task(
|
|
42
|
+
task="Scrape the top 5 products on producthunt.com today.",
|
|
43
|
+
llm="claude-opus-4-7",
|
|
44
|
+
llm_api_key="sk-ant-...",
|
|
45
|
+
country="US",
|
|
46
|
+
)
|
|
47
|
+
print(job.final_result)
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Webhooks
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from browsa import webhooks
|
|
56
|
+
|
|
57
|
+
# In your receiver (Flask/FastAPI/whatever):
|
|
58
|
+
ok = webhooks.verify_signature(
|
|
59
|
+
body=raw_request_body,
|
|
60
|
+
header=request.headers["X-Agents-Signature"],
|
|
61
|
+
secret=os.environ["BROWSA_WEBHOOK_SECRET"], # hex-encoded
|
|
62
|
+
)
|
|
63
|
+
if not ok:
|
|
64
|
+
return 401
|
|
65
|
+
# Trust the payload only after this point.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## What you get
|
|
69
|
+
|
|
70
|
+
| Capability | Notes |
|
|
71
|
+
|---|---|
|
|
72
|
+
| Sync + async clients | `Client` + `AsyncClient`, same surface |
|
|
73
|
+
| Real `Job` envelope | Typed dataclass + `.raw` escape hatch |
|
|
74
|
+
| Long-poll waits | `wait_for_job(timeout=...)` uses server-side `?wait=30` |
|
|
75
|
+
| Webhook signature verify | HMAC-SHA256, constant-time compare, skew check |
|
|
76
|
+
| Canonical error envelope | `AuthError`, `InvalidIDError`, `RateLimitError`, etc. |
|
|
77
|
+
| `X-Request-Id` propagation | Every error carries the server's request id |
|
|
78
|
+
| Zero deps | Single wheel, audit-friendly, no transitive surface |
|
|
79
|
+
|
|
80
|
+
## Advanced
|
|
81
|
+
|
|
82
|
+
### Long-running tasks with progress callback
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
def show(job):
|
|
86
|
+
print(f" step {job.step_count}/{job.progress_total} status={job.status}")
|
|
87
|
+
|
|
88
|
+
job = c.run_task(
|
|
89
|
+
task="Open-ended research: scrape arxiv for papers on test-time compute, return top 10 by citation.",
|
|
90
|
+
llm="claude-opus-4-7",
|
|
91
|
+
llm_api_key="sk-ant-...",
|
|
92
|
+
max_steps=80,
|
|
93
|
+
on_progress=show,
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Interactive (input_required) tasks
|
|
98
|
+
|
|
99
|
+
If your task can pause for human input (captcha, decision point), watch for status `input_required` and respond:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
job = c.create_task(task="...", llm="...", llm_api_key="...")
|
|
103
|
+
while not job.is_terminal:
|
|
104
|
+
job = c.get_job(job.id, wait=30)
|
|
105
|
+
if job.status == "input_required":
|
|
106
|
+
answer = input(f"Agent asks: {job.input_question}\n> ")
|
|
107
|
+
job = c.respond_to_job(job.id, answer)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### JA3-spoofed sessions
|
|
111
|
+
|
|
112
|
+
Some sites fingerprint TLS handshake shape. Set a profile to spoof macOS Chrome:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
job = c.run_task(
|
|
116
|
+
task="Go to a TLS-fingerprint-fingerprinted site",
|
|
117
|
+
llm="claude-opus-4-7", llm_api_key="sk-...",
|
|
118
|
+
ja3_profile="macos_chrome_137", # uses utls
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Docs
|
|
123
|
+
|
|
124
|
+
- API reference: <https://browsa.io/docs>
|
|
125
|
+
- Source: <https://github.com/mohasaaid/neout/tree/main/sdks/browsa-python>
|
|
126
|
+
- Issues: <https://github.com/mohasaaid/neout/issues>
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""
|
|
2
|
+
browsa — anti-detect browsers for AI agents.
|
|
3
|
+
|
|
4
|
+
Quickstart:
|
|
5
|
+
|
|
6
|
+
from browsa import Client
|
|
7
|
+
|
|
8
|
+
client = Client(api_key="agt_live_...")
|
|
9
|
+
|
|
10
|
+
# Run a task synchronously (blocks until the agent finishes)
|
|
11
|
+
job = client.run_task(
|
|
12
|
+
task="Go to news.ycombinator.com and return the top story title.",
|
|
13
|
+
llm="claude-opus-4-7",
|
|
14
|
+
llm_api_key="sk-ant-...",
|
|
15
|
+
)
|
|
16
|
+
print(job.final_result)
|
|
17
|
+
print(f"Live stream: {job.live_url}")
|
|
18
|
+
|
|
19
|
+
That's it. Five lines of Python to drive a real anti-detect browser through
|
|
20
|
+
an AI agent, get back structured output, and a live noVNC viewer URL.
|
|
21
|
+
|
|
22
|
+
For async usage:
|
|
23
|
+
|
|
24
|
+
from browsa import AsyncClient
|
|
25
|
+
|
|
26
|
+
async with AsyncClient(api_key="agt_live_...") as c:
|
|
27
|
+
job = await c.run_task(task="...", llm="claude-opus-4-7", ...)
|
|
28
|
+
|
|
29
|
+
For webhooks see browsa.webhooks.verify_signature.
|
|
30
|
+
"""
|
|
31
|
+
from .client import Client, AsyncClient
|
|
32
|
+
from .types import Job, JobStatus, Webhook
|
|
33
|
+
from .errors import (
|
|
34
|
+
BrowsaError,
|
|
35
|
+
NeoutError, # deprecated alias of BrowsaError — kept for backwards compat
|
|
36
|
+
APIError,
|
|
37
|
+
AuthError,
|
|
38
|
+
RateLimitError,
|
|
39
|
+
InvalidIDError,
|
|
40
|
+
NotFoundError,
|
|
41
|
+
TimeoutError,
|
|
42
|
+
)
|
|
43
|
+
from . import webhooks
|
|
44
|
+
|
|
45
|
+
__version__ = "0.1.0"
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"Client",
|
|
49
|
+
"AsyncClient",
|
|
50
|
+
"Job",
|
|
51
|
+
"JobStatus",
|
|
52
|
+
"Webhook",
|
|
53
|
+
"BrowsaError",
|
|
54
|
+
"NeoutError",
|
|
55
|
+
"APIError",
|
|
56
|
+
"AuthError",
|
|
57
|
+
"RateLimitError",
|
|
58
|
+
"InvalidIDError",
|
|
59
|
+
"NotFoundError",
|
|
60
|
+
"TimeoutError",
|
|
61
|
+
"webhooks",
|
|
62
|
+
"__version__",
|
|
63
|
+
]
|