|
|
|
"""Debug product name mismatch between warehouse and Trek XML""" |
|
|
|
import requests |
|
import re |
|
import xml.etree.ElementTree as ET |
|
|
|
def check_name_mismatch(): |
|
"""Check if product names match between warehouse and Trek""" |
|
|
|
|
|
try: |
|
warehouse_url = 'https://video.trek-turkey.com/bizimhesap-warehouse-xml-b2b-api-v2.php' |
|
response = requests.get(warehouse_url, verify=False, timeout=10) |
|
warehouse_xml = response.text |
|
|
|
|
|
product_pattern = r'<ProductName><!\[CDATA\[(.*?)\]\]></ProductName>' |
|
warehouse_products = re.findall(product_pattern, warehouse_xml) |
|
|
|
print(f"Warehouse products count: {len(warehouse_products)}") |
|
print("\nSample warehouse products containing 'MARLIN' or 'RAIL':") |
|
for p in warehouse_products: |
|
if 'MARLIN' in p.upper() or 'RAIL' in p.upper(): |
|
print(f" - {p}") |
|
|
|
except Exception as e: |
|
print(f"Warehouse error: {e}") |
|
|
|
print("\n" + "="*60) |
|
|
|
|
|
try: |
|
trek_url = 'https://www.trekbisiklet.com.tr/output/8582384479' |
|
response = requests.get(trek_url, verify=False, timeout=10) |
|
root = ET.fromstring(response.content) |
|
|
|
trek_products = [] |
|
for item in root.findall('.//item'): |
|
title = item.find('rootlabel') |
|
if title is not None and title.text: |
|
trek_products.append(title.text) |
|
|
|
print(f"Trek products count: {len(trek_products)}") |
|
print("\nSample Trek products containing 'MARLIN' or 'RAIL':") |
|
for p in trek_products: |
|
if 'MARLIN' in p.upper() or 'RAIL' in p.upper(): |
|
print(f" - {p}") |
|
if len([x for x in trek_products if 'MARLIN' in x.upper() or 'RAIL' in x.upper()]) > 10: |
|
break |
|
|
|
except Exception as e: |
|
print(f"Trek error: {e}") |
|
|
|
if __name__ == "__main__": |
|
check_name_mismatch() |