该警告是什么意思:Expect list <fields_enum>;得到了<class'list'>

时间:2019-09-30 10:59:59

标签: python facebook facebook-insights

我正在运行一个python程序来获取Facebook见解指标。 我收到此警告:

UserWarning:字段值可能不兼容。期望列表;得到了

这是我的代码(的一部分):

 FIELDS          = [
                     (adsinsights.AdsInsights.Field.ad_id),
                     (adsinsights.AdsInsights.Field.adset_name),        
                     (adsinsights.AdsInsights.Field.campaign_id),  

                     (adsinsights.AdsInsights.Field.reach),
                     (adsinsights.AdsInsights.Field.frequency),
                     (adsinsights.AdsInsights.Field.impressions),
                     (adsinsights.AdsInsights.Field.spend),

                     (adsinsights.AdsInsights.Field.inline_link_clicks),
                     (adsinsights.AdsInsights.Field.unique_clicks),

                     (adsinsights.AdsInsights.Field.cost_per_inline_link_click),
                     (adsinsights.AdsInsights.Field.cost_per_inline_post_engagement),
                     (adsinsights.AdsInsights.Field.cost_per_unique_click)
                   ]

 def readInsightsFromCampaign(campaignId):
     FacebookAdsApi.init(access_token=ACCESS_TOKEN, api_version=API_VERSION)

     c = campaign.Campaign(campaignId)
     params = {
         'level': adsinsights.AdsInsights.Level.account,
         'date_preset': campaign.Campaign.DatePreset.last_90d,
         'fields': FIELDS
     }

     insights = c.get_insights(params=params)
     return insights

此警告是什么意思?而我该如何避免呢?

非常感谢, 蒂姆

1 个答案:

答案 0 :(得分:1)