minimum
This commit is contained in:
@@ -79,11 +79,9 @@ if match:
|
|||||||
else:
|
else:
|
||||||
wh_masked_url = "[Invalid webhook URL]"
|
wh_masked_url = "[Invalid webhook URL]"
|
||||||
|
|
||||||
# HTTP headers - no compression to avoid parsing issues
|
# HTTP headers - minimal
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
||||||
"Accept": "application/json",
|
|
||||||
"Referer": "https://partners.nvidia.com/"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load country setting and localization config
|
# Load country setting and localization config
|
||||||
|
|||||||
@@ -22,19 +22,11 @@ first_run_dict = {name: True for name in PRODUCT_NAMES}
|
|||||||
def check_rtx_50_founders():
|
def check_rtx_50_founders():
|
||||||
global last_sku_dict, global_stock_status_dict, first_run_dict
|
global last_sku_dict, global_stock_status_dict, first_run_dict
|
||||||
|
|
||||||
# Random delay to avoid pattern detection
|
|
||||||
time.sleep(random.uniform(2, 6))
|
|
||||||
|
|
||||||
# Fetching nvidia API data
|
# Fetching nvidia API data
|
||||||
try:
|
try:
|
||||||
# Vary cache buster format to avoid pattern
|
sku_url = API_URL_SKU
|
||||||
if random.choice([True, False]):
|
|
||||||
cache_buster = f"v{random.randint(100, 999)}"
|
|
||||||
else:
|
|
||||||
cache_buster = f"{int(time.time() % 100000)}"
|
|
||||||
sku_url = f"{API_URL_SKU}&cb={cache_buster}"
|
|
||||||
|
|
||||||
response = session.get(sku_url, timeout=20)
|
response = session.get(sku_url, timeout=10)
|
||||||
logging.info(f"SKU API response: {response.status_code}")
|
logging.info(f"SKU API response: {response.status_code}")
|
||||||
if response.status_code == 429:
|
if response.status_code == 429:
|
||||||
logging.warning("Rate limited, waiting longer...")
|
logging.warning("Rate limited, waiting longer...")
|
||||||
@@ -60,6 +52,15 @@ def check_rtx_50_founders():
|
|||||||
logging.error(f"JSON decode error: {e}")
|
logging.error(f"JSON decode error: {e}")
|
||||||
logging.error(f"Full response text: {response.text}")
|
logging.error(f"Full response text: {response.text}")
|
||||||
return
|
return
|
||||||
|
except requests.exceptions.ReadTimeout:
|
||||||
|
logging.error("Read timeout - IP may be rate limited/blocked. Try changing IP or wait several hours.")
|
||||||
|
return
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
if "Failed to resolve" in str(e):
|
||||||
|
logging.error("DNS resolution failed - IP may be DNS blacklisted. Try VPN or different DNS servers.")
|
||||||
|
else:
|
||||||
|
logging.error(f"Connection error: {e}")
|
||||||
|
return
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logging.error(f"SKU API error: {e}")
|
logging.error(f"SKU API error: {e}")
|
||||||
return
|
return
|
||||||
@@ -97,19 +98,12 @@ def check_rtx_50_founders():
|
|||||||
last_sku_dict[product_name] = product_sku
|
last_sku_dict[product_name] = product_sku
|
||||||
first_run_dict[product_name] = False
|
first_run_dict[product_name] = False
|
||||||
|
|
||||||
# Random delay between requests
|
|
||||||
time.sleep(random.uniform(1, 4))
|
|
||||||
|
|
||||||
# Check product availability in API_URL_STOCK for each SKU
|
# Check product availability in API_URL_STOCK for each SKU
|
||||||
if random.choice([True, False]):
|
api_stock_url = f"{API_URL_STOCK}{product_sku}"
|
||||||
cache_param = f"v{random.randint(100, 999)}"
|
|
||||||
else:
|
|
||||||
cache_param = f"{int(time.time() % 100000)}"
|
|
||||||
api_stock_url = f"{API_URL_STOCK}{product_sku}&cb={cache_param}"
|
|
||||||
logging.info(f"[{product_name}] Checking stock: {api_stock_url}")
|
logging.info(f"[{product_name}] Checking stock: {api_stock_url}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = session.get(api_stock_url, timeout=20)
|
response = session.get(api_stock_url, timeout=10)
|
||||||
logging.info(f"[{product_name}] Stock API response: {response.status_code}")
|
logging.info(f"[{product_name}] Stock API response: {response.status_code}")
|
||||||
if response.status_code == 429:
|
if response.status_code == 429:
|
||||||
logging.warning(f"[{product_name}] Rate limited, skipping...")
|
logging.warning(f"[{product_name}] Rate limited, skipping...")
|
||||||
|
|||||||
Reference in New Issue
Block a user