Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if story_id == 0:
comment = 'No post fround in the first creative of this ad set.'
self.add_check_result(
result,
{
"eligibility": 3,
}
)
result['preview_url'] = comment
results.append(result)
continue
# Check whether the creative's post is IG ready
try:
# This Graph API call is not a part of Ads API thus no SDK
post = FacebookAdsApi.get_default_api().call(
'GET',
(story_id,),
params={
'fields': 'is_instagram_eligible,child_attachments'
},
)
post_ig_eligible = post.json()['is_instagram_eligible']
except FacebookRequestError:
post_ig_eligible = False
result['creative_ready'] = post_ig_eligible
if post_ig_eligible:
self.add_check_result(
result,
{
"eligibility": 5,
}
def api_get(path, api=None, url=default_api_url):
if api is None:
api = FacebookAdsApi.get_default_api()
response = api.call('GET', url + path)
return response.json()
def api_post(path, params={}, api=None, url=default_api_url, **kwargs):
if api is None:
api = FacebookAdsApi.get_default_api()
response = api.call('POST', url + path, params=params, **kwargs)
return response.json()