Title says it all. I am trying to connect the Facebook's Marketing API but am encountering the error above. I am a real rookie with all of this and would appreciate any help, guidance, or tutorial links.
from facebook_business.adobjects import campaign
adcampaign = campaign.Campaign('xxxxxxxxxx')
params = {
'date_preset': campaign.Campaign.DatePreset.last_7d,
}
insights=campaign.Campaign('xxxxxxxxxx').get_insights(params=params)
print(insights)
This is the exact error message "facebook_business.exceptions.FacebookBadObjectError: Api call cannot be made if api is not set"
You need to initialize your facebook object. According to the README of the python project, you need to call FacebookAdsApi.init
first:
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.