我正在尝试使用 Python Business SDK 通过 Facebook 的营销 API 获取营销活动洞察,但我收到了 FacebookRequestError:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v3.1/2603111949730990/insights
Params: {}
Status: 400
Response:
{
"error": {
"message": "Error accessing adreport job.",
"type": "OAuthException",
"code": 2601,
"error_subcode": 1815107,
"is_transient": true,
"error_user_title": "Loading Async Ads Report Failed",
"error_user_msg": "Sorry, the report cannot be loaded successfully. Please check if your job status is completed instead of failed or running before fetching the data.",
"fbtrace_id": "BQJsdi3g5tX"
}
}
我已经尝试通过检查作业状态是否不是“作业完成”以及作业完成百分比是否小于 100 来修改 wait_for_async_job() 函数的代码,但问题仍然存在。
def wait_for_async_job(async_job):
async_job.remote_read()
while async_job[AdReportRun.Field.async_status] != 'Job Completed' and async_job[AdReportRun.Field.async_percent_completion] < 100:
time.sleep(1)
async_job.remote_read()
任何帮助将非常感激。先感谢您!