gpt4 book ai didi

Python facebookads sdk - 找不到publisher_platform故障

转载 作者:太空宇宙 更新时间:2023-11-03 15:46:13 25 4
gpt4 key购买 nike

我正在尝试使用 facebookads Python SDK 获取“平台”(或有时为“publisher_platform”)分割,因为我们在 Facebook 和 Instagram 上转换广告。这是我的代码:

insights = account.get_insights(fields=[
AdsInsights.Field.ad_id,
AdsInsights.Field.impressions,
AdsInsights.Field.reach,
AdsInsights.Field.spend,
], params={
'level': AdsInsights.Level.ad,
'breakdowns': AdsInsights.Breakdowns.publisher_platform,
'time_range': {'since': str(datetime.date(2016,12,1)), 'until': str(datetime.date(2016,12,31))}
})

代码引发了以下错误消息:

Traceback (most recent call last):
File "<stdin>", line 8, in <module>
AttributeError: class Breakdowns has no attribute 'publisher_platform'

除了第 8 行之外,一切都正常。如何解决这个问题?

最佳答案

看起来 SDK 中实际上缺少它。当您看到此类问题时,只需检查该文件是否存在即可。

在 SDK 中可用之前,您可以只使用字符串:

insights = account.get_insights(fields=[
AdsInsights.Field.ad_id,
AdsInsights.Field.impressions,
AdsInsights.Field.reach,
AdsInsights.Field.spend,
], params={
'level': AdsInsights.Level.ad,
'breakdowns': 'publisher_platform',
'time_range': {'since': str(datetime.date(2016,12,1)), 'until': str(datetime.date(2016,12,31))}
})

关于Python facebookads sdk - 找不到publisher_platform故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41729593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com