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
|
import time
|
||||||
|
|
||||||
# Validate required parameters
|
# Validate required parameters
|
||||||
if not username:
|
if not username or not username.strip():
|
||||||
raise ValueError("username is required")
|
raise ValueError("username is required and cannot be empty or whitespace")
|
||||||
if not password:
|
if not password or not password.strip():
|
||||||
raise ValueError("password is required")
|
raise ValueError("password is required and cannot be empty or whitespace")
|
||||||
if not url:
|
if not url or not url.strip():
|
||||||
raise ValueError("url is required")
|
raise ValueError("url is required and cannot be empty or whitespace")
|
||||||
|
|
||||||
# Launch browser
|
# Launch browser
|
||||||
browser = playwright.chromium.launch(headless=headless)
|
browser = playwright.chromium.launch(headless=headless)
|
||||||
|
|||||||
Reference in New Issue
Block a user