You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Browserbase Python library provides convenient access to the Browserbase REST API from any Python 3.9+
6
+
The Stagehand Python library provides convenient access to the Stagehand REST API from any Python 3.9+
7
7
application. The library includes type definitions for all request params and response fields,
8
8
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
9
9
10
10
It is generated with [Stainless](https://www.stainless.com/).
11
11
12
12
## Documentation
13
13
14
-
The REST API documentation can be found on [browserbase.com](https://browserbase.com). The full API of this library can be found in [api.md](api.md).
14
+
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). The full API of this library can be found in [api.md](api.md).
15
15
16
16
## Installation
17
17
@@ -29,9 +29,9 @@ The full API of this library can be found in [api.md](api.md).
29
29
30
30
```python
31
31
import os
32
-
from stagehand importBrowserbase
32
+
from stagehand importStagehand
33
33
34
-
client =Browserbase(
34
+
client =Stagehand(
35
35
api_key=os.environ.get("STAGEHAND_API_KEY"), # This is the default and can be omitted
36
36
# or 'production' | 'local'; defaults to "production".
37
37
environment="dev",
@@ -50,14 +50,14 @@ so that your API Key is not stored in source control.
50
50
51
51
## Async usage
52
52
53
-
Simply import `AsyncBrowserbase` instead of `Browserbase` and use `await` with each API call:
53
+
Simply import `AsyncStagehand` instead of `Stagehand` and use `await` with each API call:
54
54
55
55
```python
56
56
import os
57
57
import asyncio
58
-
from stagehand importAsyncBrowserbase
58
+
from stagehand importAsyncStagehand
59
59
60
-
client =AsyncBrowserbase(
60
+
client =AsyncStagehand(
61
61
api_key=os.environ.get("STAGEHAND_API_KEY"), # This is the default and can be omitted
62
62
# or 'production' | 'local'; defaults to "production".
63
63
environment="dev",
@@ -93,11 +93,11 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
93
93
import os
94
94
import asyncio
95
95
from stagehand import DefaultAioHttpClient
96
-
from stagehand importAsyncBrowserbase
96
+
from stagehand importAsyncStagehand
97
97
98
98
99
99
asyncdefmain() -> None:
100
-
asyncwithAsyncBrowserbase(
100
+
asyncwithAsyncStagehand(
101
101
api_key=os.environ.get("STAGEHAND_API_KEY"), # This is the default and can be omitted
102
102
http_client=DefaultAioHttpClient(),
103
103
) as client:
@@ -124,9 +124,9 @@ Typed requests and responses provide autocomplete and documentation within your
124
124
Nested parameters are dictionaries, typed using `TypedDict`, for example:
125
125
126
126
```python
127
-
from stagehand importBrowserbase
127
+
from stagehand importStagehand
128
128
129
-
client =Browserbase()
129
+
client =Stagehand()
130
130
131
131
response = client.sessions.start(
132
132
env="LOCAL",
@@ -146,9 +146,9 @@ All errors inherit from `stagehand.APIError`.
146
146
147
147
```python
148
148
import stagehand
149
-
from stagehand importBrowserbase
149
+
from stagehand importStagehand
150
150
151
-
client =Browserbase()
151
+
client =Stagehand()
152
152
153
153
try:
154
154
client.sessions.start(
@@ -187,10 +187,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
187
187
You can use the `max_retries` option to configure or disable retry settings:
188
188
189
189
```python
190
-
from stagehand importBrowserbase
190
+
from stagehand importStagehand
191
191
192
192
# Configure the default for all requests:
193
-
client =Browserbase(
193
+
client =Stagehand(
194
194
# default is 2
195
195
max_retries=0,
196
196
)
@@ -207,16 +207,16 @@ By default requests time out after 1 minute. You can configure this with a `time
207
207
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
0 commit comments