i am trying to use python request for accessing facebook ads daily total spend. I tried this solution but i don't have app_secret so i try this but this one focus on campaign level spends.
My question is how i can get daily total spend with request or how can i use facebook python sdk with only account id and access token as used in example in the link and get only date and total spend? Below code shows ad level for me but i can't groupby date to sum spend because date column here is interval . b
import requests
import json
token='*****'
act_id='act_*******'
first_request = 'https://graph.facebook.com/v7.0/act_id/campaigns?fields=insights{spend}&limit=10000&access_token=%s'%token
result = requests.get(first_request)
content_dict = json.loads(result.content)
content_dict
this is a sample the output example:
{'insights': {'data': [{'spend': '31.39',
'date_start': '2020-04-13',
'date_stop': '2020-05-12'}],
'paging': {'cursors': {'before': 'MAZDZD', 'after': 'MAZDZD'}}},
'id': '*******'},