import requests

awin_token = 'bebd7839-013a-434d-a3da-7db2ecefb6b1'
publisher_id = 374301
headers = {'Authorization': f'Bearer {awin_token}'}

# Use correct publisher ID
endpoints = [
    ('Programmes', f'https://api.awin.com/publishers/{publisher_id}/programmes'),
    ('Programmes joined', f'https://api.awin.com/publishers/{publisher_id}/programmes?relationship=joined'),
    ('Datafeed list', f'https://productdata.awin.com/datafeed/list/apikey/{awin_token}/language/nl/fid//columns/aw_deep_link,product_name,aw_product_id,merchant_product_id,merchant_image_url,description,merchant_category,search_price,merchant_name,aw_image_url,brand_name,colour,rrp_price,ean,model_number,in_stock,currency/format/csv/delimiter/%2C/compression/gzip/adultcontent/1/'),
]

for name, url in endpoints:
    try:
        r = requests.get(url, headers=headers, timeout=30, stream=True)
        print(f'{name}: {r.status_code} ({r.headers.get("Content-Type","")})')
        if r.ok:
            content = next(r.iter_content(500))
            try:
                print(f'  {content.decode("utf-8", errors="replace")[:500]}')
            except:
                print(f'  Binary data, size: {r.headers.get("Content-Length", "?")}')
        else:
            print(f'  {r.text[:200]}')
    except Exception as e:
        print(f'{name}: ERROR - {e}')
    print()
