API ReferenceAnnouncementsCommunity Discussion
API ReferenceCommunity DiscussionAnnouncementsSubscribeLog In
Community Discussion

Community Discussion

Ask a Question
Back to All

How to extract revenues by publisher with Python Script (split by platform)

Hello all,

I have this script to extract my campaign data splited by plateform (see bellow).
But now, I want to know how to extract the revenues earn by my publisher.

Do you knwo how I can do that ?


My Script :

client_id =XXXXXXXXXXX
client_secret = XXXXXXXXXXXXX

start_date = "2021-06-08"
end_date = "2021-06-08"

account_id = "XXXXXXXX"
dimension = "content_provider_breakdown"
folder_path = r"/Users//Documents/"

url = "https://backstage.taboola.com/backstage/oauth/token"
payload = f"client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials"
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.request("POST", url, data=payload, headers=headers)
data = response.json()
access_token = data["access_token"]

url = f"https://backstage.taboola.com/backstage/api/1.0/{account_id}/reports/campaign-summary/dimensions/{dimension}"

url = f"https://backstage.taboola.com/backstage/api/1.0/{account_id}"
querystring = {"start_date":start_date,"end_date":end_date,"platform":"DESK"}
bearer = f"Bearer {access_token}"
headers = {"Authorization": bearer}

response = requests.request("GET", url, headers=headers, params=querystring)
data = response.json()