fix: improve parameter validation to reject whitespace-only strings
- Add .strip() check to username, password, url validation - Update error messages to clarify whitespace rejection - Prevents bugs where whitespace-only strings pass validation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,12 +36,12 @@ def login(
|
||||
import time
|
||||
|
||||
# Validate required parameters
|
||||
if not username:
|
||||
raise ValueError("username is required")
|
||||
if not password:
|
||||
raise ValueError("password is required")
|
||||
if not url:
|
||||
raise ValueError("url is required")
|
||||
if not username or not username.strip():
|
||||
raise ValueError("username is required and cannot be empty or whitespace")
|
||||
if not password or not password.strip():
|
||||
raise ValueError("password is required and cannot be empty or whitespace")
|
||||
if not url or not url.strip():
|
||||
raise ValueError("url is required and cannot be empty or whitespace")
|
||||
|
||||
# Launch browser
|
||||
browser = playwright.chromium.launch(headless=headless)
|
||||
|
||||
Reference in New Issue
Block a user