【问题标题】:Python Adwords API suds.sudsobject Parse Response Containing Empty Indexed Key?Python Adwords API suds.sudsobject 解析包含空索引键的响应?
【发布时间】:2017-02-21 21:43:03
【问题描述】:

我有一个泡沫对象:

<class 'suds.sudsobject.AdGroupPage'>

泡沫反应:

(AdGroupPage){
   totalNumEntries = 1
   Page.Type = "AdGroupPage"
   entries[] = 
      (AdGroup){
         id = 38496562285
         campaignId = 759990659
         campaignName = "Some Campaign #1"
         name = "Second group"
         status = "ENABLED"
         biddingStrategyConfiguration = 
            (BiddingStrategyConfiguration){
               biddingStrategyType = "MANUAL_CPC"
               bids[] = 
                  (CpcBid){
                     Bids.Type = "CpcBid"
                     bid = 
                        (Money){
                           ComparableValue.Type = "Money"
                           microAmount = 1230000
                        }
                     cpcBidSource = "ADGROUP"
                  },
            }
      },
 }

我正在尝试使用 Google Adwords API 创建 SET 操作,以使用 Adwords API mutate 操作将广告组出价更改为其他内容。

这是我在 PYTHON 中的尝试:

operations = [{
    'operator': 'SET',
    'operand': {
        'id': 38496562285,
        'biddingStrategyConfiguration': {
            'bids': [{
                'bid': {
                    'microAmount': 4560000
                    }
                }]
            }
        }
    }]

我请求的错误是:

suds.TypeNotFound: Type not found: 'bid'

这是一个成功运行的简单示例:

operations = [{
      'operator': 'SET',
      'operand': {
          'id': ad_group_id,
          'status': 'PAUSED'
      }
  }]

我的问题是,我不知道如何处理来自 suds 响应的 bids[] 语法。我应该如何修改我的字典以使用空列表键?

【问题讨论】:

    标签: python soap suds google-ads-api


    【解决方案1】:

    看起来我必须包含一个名为 xsi_type 的东西。万一有人偶然发现这个问题,这就是我的operations 对象的样子:

    operations = [{
          'operator': 'SET',
          'operand': {
            'id': 38496562285,
            'biddingStrategyConfiguration': {
              'bids': [{
                'xsi_type': 'CpcBid',
                'bid': {'microAmount': 4560000}
                }]
              }
            }
          }]
    

    这是v201609 AdGroupService.BiddingStrategyConfiguration 的链接。它没有提到xsi_type,但是如果您遇到bids[] 之类的字段,您现在知道尝试在您的操作中定义xsi_type。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-03
      • 1970-01-01
      • 2019-02-08
      • 2019-12-11
      • 2018-12-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多