WIP - anti-antibot policies
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import requests
|
||||
import logging
|
||||
import time
|
||||
import random
|
||||
from env_config import HEADERS, PRODUCT_NAMES, API_URL_SKU, API_URL_STOCK, PRODUCT_URL
|
||||
from notifier import send_discord_notification, send_out_of_stock_notification, send_sku_change_notification
|
||||
from requests.adapters import HTTPAdapter, Retry
|
||||
@@ -22,8 +23,9 @@ def check_rtx_50_founders():
|
||||
|
||||
# Fetching nvidia API data
|
||||
try:
|
||||
cache_buster = int(time.time() * 1000)
|
||||
sku_url = f"{API_URL_SKU}&_t={cache_buster}"
|
||||
# Natural cache busting that looks like API versioning
|
||||
version_param = f"1.{int(time.time() % 10000)}.{random.randint(10, 99)}"
|
||||
sku_url = f"{API_URL_SKU}&api_version={version_param}"
|
||||
|
||||
response = session.get(sku_url, timeout=10)
|
||||
logging.info(f"SKU API response: {response.status_code}")
|
||||
@@ -62,8 +64,8 @@ def check_rtx_50_founders():
|
||||
first_run_dict[product_name] = False
|
||||
|
||||
# Check product availability in API_URL_STOCK for each SKU
|
||||
cache_buster = int(time.time() * 1000)
|
||||
api_stock_url = f"{API_URL_STOCK}{product_sku}&_t={cache_buster}"
|
||||
version_param = f"1.{int(time.time() % 10000)}.{random.randint(10, 99)}"
|
||||
api_stock_url = f"{API_URL_STOCK}{product_sku}&api_version={version_param}"
|
||||
logging.info(f"[{product_name}] Checking stock: {api_stock_url}")
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user