import requests
import re
# Auth
soap_auth = '''
35058
bf0b9eef0da6caf55fe614518375280fe5c4ecca
false
nl_NL
false
'''
r = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_auth,
headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': 'authenticate'},
timeout=15)
cookies = r.cookies
print(f'Auth: {r.status_code}')
# Get affiliate sites first
soap_sites = '''
'''
# The WSDL says getAffiliateSites takes no params. But error says "Missing parameter"
# Maybe we need to set affiliateSiteID on the session first via setAffiliateSiteID
# Or pass it as header. Let me check WSDL...
# Actually, TradeTracker SOAP requires calling getAffiliateSites first, then setAffiliateSite
# But let's try getting WSDL first
print('\n--- Checking WSDL ---')
r_wsdl = requests.get('https://ws.tradetracker.com/soap/affiliate?wsdl', timeout=15)
wsdl = r_wsdl.text
# Find all operations
ops = re.findall(r'
'''
r2 = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_sites2,
headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': ''},
cookies=cookies, timeout=30)
print(f'\ngetAffiliateSites v2: {r2.status_code}')
print(f'{r2.text[:1000]}')
# Try with the correct namespace from WSDL response
soap_sites3 = '''
'''
r3 = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_sites3,
headers={'Content-Type': 'text/xml; charset=utf-8'},
cookies=cookies, timeout=30)
print(f'\ngetAffiliateSites v3: {r3.status_code}')
print(f'{r3.text[:2000]}')