fix: disabled HEADLESS mode by default and updated dependencies

This commit is contained in:
Alvaro Santos Andres
2025-07-25 13:51:19 +02:00
parent 7bdb47618c
commit f9d923b86b
6 changed files with 28 additions and 18 deletions
+2 -1
View File
@@ -30,7 +30,7 @@ VERSION = get_version_from_env() or "unknown"
USE_XVFB = os.getenv("USE_XVFB") in ["true", "1"] if os.getenv("USE_XVFB") else None
USE_HEADLESS = (
os.getenv("USE_HEADLESS") in ["true", "1"] if os.getenv("USE_HEADLESS") else None
os.getenv("USE_HEADLESS") in ["true", "1"] if os.getenv("USE_HEADLESS") else False
)
PROXY = os.getenv("PROXY")
@@ -38,6 +38,7 @@ PROXY = os.getenv("PROXY")
CHALLENGE_TITLES = [
# Cloudflare
"Just a moment...",
"Verifying you are human",
# DDoS-GUARD
"DDoS-Guard",
]
+13 -6
View File
@@ -5,7 +5,7 @@ from fastapi import Header, HTTPException
from httpx import codes
from sbase import SB, BaseCase
from src.consts import LOG_LEVEL, PROXY, USE_HEADLESS
from src.consts import LOG_LEVEL, PROXY, USE_HEADLESS, USE_XVFB
logger = logging.getLogger("uvicorn.error")
logger.setLevel(LOG_LEVEL)
@@ -27,12 +27,19 @@ def get_sb(
detail="SOCKS5 proxy with authentication is not supported. Check README for more info.",
)
kwargs = {
"uc": True,
"headless": USE_HEADLESS,
"xvfb": USE_XVFB,
"locale_code": "en",
"ad_block": True,
"proxy": proxy,
}
logger.info("Creating SeleniumBase instance with parameters: %s", kwargs)
with SB(
uc=True,
headless=USE_HEADLESS,
locale_code="en",
ad_block=True,
proxy=proxy,
**kwargs,
) as sb:
yield sb