我正在使用异步方法来生成见解报告。为了从中获取数据,我遍历了结果,一次给了我25个值。如何增加此限制?
更多细节:
日志:
2017-03-30 09:27:41.926362 DEBUG 171:0 facebook.py:get_ads_insight insights type: <class 'facebookads.api.Cursor'>
2017-03-30 09:27:41.926979 DEBUG 176:0 facebook.py:get_ads_insight insights present: 25
Insights API facebook:https://developers.facebook.com/docs/marketing-api/insights/async/v2.8
样例代码:
from facebookads.adobjects.campaign import Campaign
from facebookads.adobjects.adsinsights import AdsInsights
from facebookads.adobjects.adreportrun import AdReportRun
import time
campaign = Campaign(<CAMPAIGN_ID>)
params = {
'level': AdsInsights.Level.campaign,
}
async_job = campaign.get_insights(params=params, async=True)
async_job.remote_read()
while async_job[AdReportRun.Field.async_percent_completion] < 100:
time.sleep(1)
async_job.remote_read()
time.sleep(1)
print(async_job.get_result())
最佳答案
您可以将参数传递给get_result()
,例如:async_job.get_result(params={'limit': '100',})
关于python - 如何增加Facebook Insights API游标的限制,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43127264/