1

I want to create an AdCreative using python facebook business sdk, i know the code below works, but sometimes it gets Timeout as a result.

The error code is:

File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 353, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='graph.facebook.com', port=443): Read timed out. (read timeout=None)

Is there a way that i can set the timeout value for remote_create action or for whole graph api calls?

video_data = AdCreativeVideoData()
video_data[AdCreativeVideoData.Field.video_id] = video_id
video_data[AdCreativeVideoData.Field.image_url] = thumb
video_data[AdCreativeVideoData.Field.call_to_action] = {
    'type': 'PLAY_GAME',
    'value': {
        "application": app_id,
        "link": "https://apps.apple.com/is/app/xxxxxx"
    },
}

object_story_spec = AdCreativeObjectStorySpec()
object_story_spec[AdCreativeObjectStorySpec.Field.page_id] = page_id
object_story_spec[AdCreativeObjectStorySpec.Field.video_data] = video_data

creative = AdCreative(parent_id=ad_account_id)
creative[AdCreative.Field.name] = 'Test Creative Ad'
creative[AdCreative.Field.object_story_spec] = object_story_spec
resp = creative.remote_create()
Kerim Siper
  • 87
  • 10

0 Answers0