2017-02-21 1 views
0

은 내가 비눗물 개체가 :Python Adwords API suds.sudsobject 빈 색인 키가 포함 된 구문 분석 응답?

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

내가 애드워즈 API를 사용하여 다른 뭔가에 광고 그룹 입찰을 변경하려면 Google 애드워즈 API와 SET 작업을 만들려고 해요 mutate operation.

이것은 PYTHON 내 시도 :

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

내 요청에서 오류는 다음과 같습니다

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

:

suds.TypeNotFound: Type not found: 'bid' 

다음은 성공적으로 작동하는 간단한 예제 내 문제는, 나는하지 않는다. 이제 bids[] 구문을 suds 응답에서 처리하는 방법. 빈 목록 키로 작업하려면 사전을 어떻게 수정해야합니까?

답변

0

나는 xsi_type이라는 것을 포함해야하는 것처럼 보입니다.

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

v201609 AdGroupService.BiddingStrategyConfiguration에 대한 링크입니다 : 년의 경우 사람이 내 operations 객체가 어떻게 생겼는지입니다,이 질문을 통해 실수를 한단다. xsi_type은 언급되어 있지 않지만 bids[]과 같은 필드를 발견하면 작동시 xsi_type을 정의하려고합니다.