Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: address review violations — drop env var fallback, fix cross-fs move

sauravpanda56d8aa8483f3
diff --git a/browser_use/skill_cli/commands/cloud.py b/browser_use/skill_cli/commands/cloud.py
index 005733937..630273b08 100644
--- a/browser_use/skill_cli/commands/cloud.py
+++ b/browser_use/skill_cli/commands/cloud.py
@@ -72,28 +72,11 @@ def _write_config(data: dict) -> None:
def _get_api_key_or_none() -> str | None:
- """Return API key from CLI config file, or None if not found.
-
- Also checks BROWSER_USE_API_KEY env var for backwards compatibility,
- but emits a deprecation warning and prompts the user to migrate.
- """
+ """Return API key from CLI config file, or None if not found."""
from browser_use.skill_cli.config import get_config_value
val = get_config_value('api_key')
- if val is not None:
- return str(val)
-
- # Backwards-compat: accept env var but warn the user to migrate
- env_key = os.environ.get('BROWSER_USE_API_KEY')
- if env_key:
- print(
- 'Warning: BROWSER_USE_API_KEY env var is deprecated for the CLI. '
- 'Run `browser-use config set api_key <key>` to migrate.',
- file=sys.stderr,
- )
- return env_key
-
- return None
+ return str(val) if val is not None else None
def _get_api_key() -> str:
@@ -103,10 +86,14 @@ def _get_api_key() -> str:
return key
print('Error: No API key found.', file=sys.stderr)
- print('Already have an account? Get a key at: https://cloud.browser-use.com/settings?tab=api-keys&new=1', file=sys.stderr)
- print(' Then run: browser-use cloud login <key>', file=sys.stderr)
- print('No account? Run: browser-use cloud signup', file=sys.stderr)
- print(' This creates an agent account you can claim later with: browser-use cloud signup --claim', file=sys.stderr)
+ if os.environ.get('BROWSER_USE_API_KEY'):
+ print(' Note: BROWSER_USE_API_KEY env var is set but not used by the CLI.', file=sys.stderr)
+ print(' Run: browser-use config set api_key "$BROWSER_USE_API_KEY"', file=sys.stderr)
+ else:
+ print('Already have an account? Get a key at: https://cloud.browser-use.com/settings?tab=api-keys&new=1', file=sys.stderr)
+ print(' Then run: browser-use cloud login <key>', file=sys.stderr)
+ print('No account? Run: browser-use cloud signup', file=sys.stderr)
+ print(' This creates an agent account you can claim later with: browser-use cloud signup --claim', file=sys.stderr)
sys.exit(1)
diff --git a/browser_use/skill_cli/commands/setup.py b/browser_use/skill_cli/commands/setup.py
index 27790869e..c56d11a82 100644
--- a/browser_use/skill_cli/commands/setup.py
+++ b/browser_use/skill_cli/commands/setup.py
@@ -215,6 +215,7 @@ def _install_cloudflared() -> bool:
# Linux: download binary + verify SHA256 checksum before installing
import hashlib
import platform
+ import shutil
import tempfile
import urllib.request
@@ -243,7 +244,7 @@ def _install_cloudflared() -> bool:
if not os.access('/usr/local/bin', os.W_OK):
dest = Path.home() / '.local' / 'bin' / 'cloudflared'
dest.parent.mkdir(parents=True, exist_ok=True)
- tmp_path.rename(dest)
+ shutil.move(str(tmp_path), dest)
dest.chmod(0o755)
finally:
tmp_path.unlink(missing_ok=True)