|
|
|
"""Check warehouse API live for Marlin products""" |
|
|
|
import requests |
|
import re |
|
|
|
def check_warehouse(): |
|
"""Check what's really in warehouse""" |
|
|
|
url = 'https://video.trek-turkey.com/bizimhesap-warehouse-xml-b2b-api-v2.php' |
|
|
|
try: |
|
response = requests.get(url, verify=False, timeout=15) |
|
if response.status_code != 200: |
|
print(f"Failed: {response.status_code}") |
|
return |
|
|
|
xml_text = response.text |
|
print(f"✅ API Response received: {len(xml_text)} chars") |
|
|
|
|
|
product_pattern = r'<ProductName><!\[CDATA\[(.*?)\]\]></ProductName>' |
|
products = re.findall(product_pattern, xml_text) |
|
|
|
print(f"Total products: {len(products)}") |
|
print("\n" + "="*60) |
|
|
|
|
|
print("SEARCHING FOR MARLIN VARIATIONS:") |
|
marlin_found = [] |
|
|
|
for p in products: |
|
p_upper = p.upper() |
|
|
|
if any(x in p_upper for x in ['MARLIN', 'MARLİN', 'MARL1N']): |
|
marlin_found.append(p) |
|
|
|
if marlin_found: |
|
print(f"✅ Found {len(marlin_found)} Marlin products:") |
|
for m in marlin_found: |
|
print(f" - {m}") |
|
else: |
|
print("❌ NO MARLIN PRODUCTS FOUND") |
|
|
|
|
|
print("\n" + "="*60) |
|
print("TREK BIKE PRODUCTS (first 20):") |
|
trek_bikes = [] |
|
for p in products: |
|
p_upper = p.upper() |
|
if any(x in p_upper for x in ['TREK', 'RAIL', 'FX', 'DOMANE', 'CHECKPOINT', 'EMONDA']): |
|
if not any(x in p_upper for x in ['HANGER', 'KULAK', 'VIDA', 'KAPAK', 'BATARYA']): |
|
trek_bikes.append(p) |
|
if len(trek_bikes) >= 20: |
|
break |
|
|
|
for t in trek_bikes: |
|
print(f" - {t}") |
|
|
|
|
|
print("\n" + "="*60) |
|
print("Products with '5' (bike models, first 10):") |
|
five_products = [] |
|
for p in products: |
|
if '5' in p and not any(x in p.upper() for x in ['HANGER', 'KULAK', 'VIDA', 'KAPAK']): |
|
five_products.append(p) |
|
if len(five_products) >= 10: |
|
break |
|
|
|
for f in five_products: |
|
print(f" - {f}") |
|
|
|
except Exception as e: |
|
print(f"❌ Error: {e}") |
|
print(f"Error type: {type(e).__name__}") |
|
|
|
if __name__ == "__main__": |
|
print("Checking live warehouse API...") |
|
print("URL: https://video.trek-turkey.com/bizimhesap-warehouse-xml-b2b-api-v2.php") |
|
print("="*60) |
|
check_warehouse() |