Last active
May 30, 2024 06:22
-
-
Save frutik/b0a431875a8274f2f597152813cfec8f to your computer and use it in GitHub Desktop.
Tradetracker Soap API - python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from requests import Session | |
from zeep import Client | |
from zeep.transports import Transport | |
from zeep import helpers | |
session = Session() | |
client = Client('http://ws.tradetracker.com/soap/affiliate?wsdl', transport=Transport(session=session)) | |
client.service.authenticate('<customer-id>', '<password>', sandbox=False, locale='nl_NL', demo=False) | |
soap_response = client.service.getCampaigns('<client-site-id>', 'accepted') | |
dict_response = helpers.serialize_object(soap_response, dict) | |
json_response = json.dumps(dict_response, default=lambda x: f'{x}') | |
mport datetime | |
import pytz | |
f = datetime.datetime.now(tz=pytz.timezone('Europe/Amsterdam')) - datetime.timedelta(days=1) | |
len(client.service.getConversionTransactions(<siteid>, {})) | |
len(client.service.getConversionTransactions(<siteid>, {'registrationDateFrom': f})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from requests import Session | |
from zeep import Client | |
from zeep.transports import Transport | |
from zeep import helpers | |
session = Session() | |
client = Client('http://ws.tradetracker.com/soap/merchant?wsdl', transport=Transport(session=session)) | |
client.service.authenticate('<customer-id>', '<password>', sandbox=False, locale='nl_NL', demo=False) | |
soap_response = client.service.getCampaigns() | |
dict_response = helpers.serialize_object(soap_response, dict) | |
json_response = json.dumps(dict_response, default=lambda x: f'{x}') | |
mport datetime | |
import pytz | |
f = datetime.datetime.now(tz=pytz.timezone('Europe/Amsterdam')) - datetime.timedelta(days=1) | |
len(client.service.getConversionTransactions(<campaignID>, {})) | |
len(client.service.getConversionTransactions(<campaignID>, {'registrationDateFrom': f})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment