refactor: Use specific ImportError instead of broad Exception (#10)
Changed the exception handling in _best_chrome_target() to catch specific ImportError instead of broad Exception. This improves code clarity and avoids masking unexpected errors. Also added a debug log message to help diagnose when curl_cffi is not available. Co-authored-by: Security Bot <agent@example.com>
This commit is contained in:
@@ -76,7 +76,9 @@ def _best_chrome_target():
|
||||
try:
|
||||
from curl_cffi.requests import BrowserType
|
||||
available = {e.value for e in BrowserType}
|
||||
except Exception:
|
||||
except ImportError:
|
||||
# curl_cffi not installed or BrowserType not available
|
||||
logger.debug("curl_cffi.BrowserType not available, using fallback targets")
|
||||
available = set()
|
||||
|
||||
# Preference order: exact chrome versions, then suffixed variants
|
||||
|
||||
Reference in New Issue
Block a user