File size: 2,093 Bytes
40daea5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
"""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"""
    
    # Get warehouse data (from PHP)
    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
        
        # Extract warehouse product names
        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)
    
    # Get Trek XML data
    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()