python facebook sdk图形api读取超时错误

voase2hg  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(273)

我想使用python facebook business sdk创建一个adcreative,我知道下面的代码可以工作,但有时它会超时。
错误代码为:
文件“/usr/local/lib/python3.9/site packages/urllib3/connectionpool.py”,第353行,在_raise_timeout raise readtimeouterror(urllib3.exceptions.readtimeouterror:httpsconnectionpool(host='graph.facebook.com',port=443):读取超时(读取超时=无)
有没有一种方法可以设置远程创建操作或整个图形api调用的超时值?

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()

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题