0
votes

I have a suds object:

<class 'suds.sudsobject.AdGroupPage'>

Suds response:

(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"
                  },
            }
      },
 }

I'm trying to create a SET operation with Google Adwords API to change an adgroup bid to something else using an Adwords API mutate operation.

This is my attempt in PYTHON:

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

The error from my request is:

suds.TypeNotFound: Type not found: 'bid'

Here's a simple example that successfully works:

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

My problem is, I don't know how to handle the bids[] syntax from the suds response. How should I modify my dictionary to work with an empty list key?

1

1 Answers

0
votes

Looks like I had to include something called xsi_type. In-case anyone stumbles across this question, this is what my operations object looked like:

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

Here is a link to v201609 AdGroupService.BiddingStrategyConfiguration. It doesn't mention xsi_type but if you encounter a field like bids[], you now know to try to define xsi_type in your operation.