Community Discussion
How to filter platform on python Script
Hello all,
Just a little question,
How can filter in order to have just the campaign on SMARTPHONE or just on DESTKOP ?
I tried something with filter but it does not woks :/
Do you know how can I do ?
Here is my screenshot https://files.readme.io/7d7a791-Script_Filter_Device.PNG
Here is my code :
account_id = "reworldmedia-mariefrance2-sc"
dimension = "campaign_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}"
querystring = {"start_date":start_date,"end_date":end_date}
bearer = f"Bearer {access_token}"
headers = {"Authorization": bearer}
response = requests.request("GET", url, headers=headers, params=querystring)
data = response.json()
df = pd.json_normalize(data['results'])
df
###################################
Thank you in advance,