import requests import sys sys.path.insert(0, r'C:\Users\Roel\clawd\scripts\demandgen-pipeline') from config import WEBGAINS_API, PUBLISHER_ID, webgains_headers # Try size=10000 for ladify cid = 1622250 url = f'{WEBGAINS_API}/auth/publishers/{PUBLISHER_ID}/campaigns/{cid}/feeds/products' params = {'size': 10000, 'fields[]': ['title','brand','price','id','ean','colour','image_link','link','description','rrp','currency','in_stock','category_name','model_number']} r = requests.get(url, headers=webgains_headers(), params=params) d = r.json() products = d.get('data', []) print(f'Ladify: {len(products)} products returned (total: {d.get("pagination",{}).get("total")})') brands = {} has_data = 0 for p in products: b = p.get('brand', 'Unknown') brands[b] = brands.get(b, 0) + 1 if p.get('ean'): has_data += 1 print(f'Products with EAN: {has_data}') print('Brands:') for b, c in sorted(brands.items(), key=lambda x: -x[1]): print(f' {b:25}: {c}') # Show sample products print('\nSample products:') seen_titles = set() for p in products[:20]: t = p.get('title', '')[:60] if t not in seen_titles: seen_titles.add(t) print(f' {p.get("brand",""):15} | {t:60} | {p.get("price",""):12} | EAN:{p.get("ean","")}') # Also try manify with size=10000 cid2 = 1622230 url2 = f'{WEBGAINS_API}/auth/publishers/{PUBLISHER_ID}/campaigns/{cid2}/feeds/products' r2 = requests.get(url2, headers=webgains_headers(), params=params) d2 = r2.json() products2 = d2.get('data', []) print(f'\nManify: {len(products2)} products returned')