Skip to content

Commit 1340835

Browse files
committed
fixes
1 parent 2dea4ac commit 1340835

File tree

10 files changed

+71
-41
lines changed

10 files changed

+71
-41
lines changed

examples/async_retrieve.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

33
import asyncio
4-
import os
54
from typing import List
65

76
from pydantic import BaseModel
7+
from utils import API_KEY
88

99
from browser_use import AsyncBrowserUse
1010

11-
client = AsyncBrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
11+
client = AsyncBrowserUse(api_key=API_KEY)
1212

1313

1414
# Regular Task

examples/async_run.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

33
import asyncio
4-
import os
54
from typing import List
65

76
from pydantic import BaseModel
7+
from utils import API_KEY
88

99
from browser_use import AsyncBrowserUse
1010

11-
# gets API Key from environment variable BROWSER_USE_API_KEY
12-
client = AsyncBrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
11+
client = AsyncBrowserUse(api_key=API_KEY)
1312

1413

1514
# Regular Task

examples/async_stream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

33
import asyncio
4-
import os
54
from typing import List
65

76
from pydantic import BaseModel
7+
from utils import API_KEY
88

99
from browser_use import AsyncBrowserUse
1010

11-
client = AsyncBrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
11+
client = AsyncBrowserUse(api_key=API_KEY)
1212

1313

1414
# Regular Task

examples/retrieve.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

3-
import os
43
import time
54
from typing import List
65

76
from pydantic import BaseModel
7+
from utils import API_KEY
88

99
from browser_use import BrowserUse
1010

11-
client = BrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
11+
client = BrowserUse(api_key=API_KEY)
1212

1313

1414
# Regular Task

examples/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

3-
import os
43
from typing import List
54

65
from pydantic import BaseModel
6+
from utils import API_KEY
77

88
from browser_use import BrowserUse
99

10-
client = BrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
10+
client = BrowserUse(api_key=API_KEY)
1111

1212

1313
# Regular Task

examples/stream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

3-
import os
43
from typing import List
54

65
from pydantic import BaseModel
6+
from utils import API_KEY
77

88
from browser_use import BrowserUse
99

10-
client = BrowserUse(api_key=os.getenv("BROWSER_USE_API_KEY"))
10+
client = BrowserUse(api_key=API_KEY)
1111

1212

1313
# Regular Task

examples/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
_API_KEY = os.getenv("BROWSER_USE_API_KEY")
4+
if not _API_KEY:
5+
raise RuntimeError("BROWSER_USE_API_KEY environment variable is not set")
6+
7+
API_KEY = _API_KEY

examples/webhooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S rye run python
1+
#!/usr/bin/env -S poetry run python
22

33
from datetime import datetime
44
from typing import Any, Dict, Tuple

poetry.lock

Lines changed: 33 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)