I am using Facebook’s python package to get ads information from their API. I keep getting throttling errors even though we only have a few hundred ads in the system right now so I wanted to check to see if anyone had a better idea for how to grab this information.
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.campaign import Campaign
from facebook_business.adobjects.ad import Ad
from facebook_business.adobjects.adcreative import AdCreative
campaigns = AdAccount('act_123456789').get_campaigns(
params={},
fields=[Campaign.Field.id,<list of other fields>]
)
ads = AdAccount('act_123456789').get_ads(
params={},
fields=[Ad.Field.id,Ad.Field.creative]
)
urls = AdAccount('act_123456789').get_ad_creatives(
params={},
fields=[AdCreative.Field.object_story_spec]
)
I’ve read the documentation on Facebook’s GitHub, especially surrounding the fields/parameters available for each function I’m using. Campaigns/Ads insinuate you can pass a date_preset parameter, but I’ve tried that and it doesn’t actually filter results.
params = {'date_preset':'last_3d'}
Passing the above parameters in the campaigns or ads call still gets me campaigns/ads from all time. I do not see any sort of date filtering options for ad creatives.
Suggestions? Is there a way to just get a set of items updated since date X? Or a more efficient way to loop through these so I’m not using all of our calls/CPU usage and getting throttled?