diff --git a/app/env_config.py b/app/env_config.py index 11d4429..cd9a79b 100644 --- a/app/env_config.py +++ b/app/env_config.py @@ -79,9 +79,23 @@ if match: else: wh_masked_url = "[Invalid webhook URL]" -# HTTP headers - minimal +# HTTP headers - Firefox working set HEADERS = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", + "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3", + "Accept-Encoding": "gzip, deflate, br, zstd", + "Cache-Control": "no-cache", + "Pragma": "no-cache", + "Sec-GPC": "1", + "Connection": "keep-alive", + "Upgrade-Insecure-Requests": "1", + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Priority": "u=0, i", + "TE": "trailers" } # Load country setting and localization config diff --git a/app/gpu_checker.py b/app/gpu_checker.py index 2ed5a7e..9bce01d 100644 --- a/app/gpu_checker.py +++ b/app/gpu_checker.py @@ -22,6 +22,14 @@ first_run_dict = {name: True for name in PRODUCT_NAMES} def check_rtx_50_founders(): global last_sku_dict, global_stock_status_dict, first_run_dict + # First get Akamai cookie by visiting main site + try: + logging.info("Getting Akamai protection cookie...") + session.get("https://marketplace.nvidia.com/fr-fr/consumer/graphics-cards/", timeout=10) + time.sleep(1) # Let the session establish + except Exception as e: + logging.warning(f"Failed to get initial cookie: {e}") + # Fetching nvidia API data try: sku_url = API_URL_SKU