Hi, I am just starting out with Adwords API. I thought a good place to 
start would be with the examples provided by google. I have started with 
the python version of the TrafficEstimatorService. However, I don't seem to 
be able to get it to work. The service always returns the following 
response:

Traceback (most recent call last):
  File "test.py", line 158, in <module>
    main(adwords_client)
  File "test.py", line 75, in main
    estimates = traffic_estimator_service.get(selector)
  File "/usr/local/lib/python2.7/site-packages/googleads/common.py", line 
700, in MakeSoapRequest
    *[_PackForSuds(arg, self.suds_client.factory) for arg in args])
  File "/usr/local/lib/python2.7/site-packages/suds/client.py", line 521, in 
__call__
    return client.invoke(args, kwargs)
  File "/usr/local/lib/python2.7/site-packages/suds/client.py", line 581, in 
invoke
    result = self.send(soapenv)
  File "/usr/local/lib/python2.7/site-packages/suds/client.py", line 613, in 
send
    reply = self.options.transport.send(request)
  File "/usr/local/lib/python2.7/site-packages/googleads/util.py", line 98, 
in PatchedHttpTransportSend
    fp = self.u2open(u2request)
  File "/usr/local/lib/python2.7/site-packages/suds/transport/http.py", 
line 132, in u2open
    return url.open(u2request, timeout=tm)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py"
, line 435, in open
    response = meth(req, response)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py"
, line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py"
, line 473, in error
    return self._call_chain(*args)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py"
, line 407, in _call_chain
    result = func(*args)
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py"
, line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

I believe I have done everything correct in order to give this the best 
shot of working. I have:


   - Created an OAuth2 ClientId, secret key and refresh token - these I 
   have placed in my yaml file
   - I have created an AdWords management account, using a different google 
   account to my ad word campaign account
   - I have acquired a developer token for my management account, and 
   placed it in my yaml file - this is a test token, I believe
   - I have set the customer id in my yaml file - I have tried both, the id 
   for my management account and the id for my campaign account
   - I have verified that the OAuth stuff works (entered invalid 
   credentials, to ensure I got an authentication error message when using the 
   wrong credentials)

The URL for my request is:

https://adwords.google.com/api/adwords/o/v201609/TrafficEstimatorService

I have also tried against version v201605 and v201607, and received the 
same error message

The header for my request is:

{'Soapaction': '""', 'Content-Type': 'text/xml; charset=utf-8', 
'Content-type': 'text/xml; charset=utf-8', 'Authorization': 'OMITTED', 
'SOAPAction': '""'}

And the soap message for my request is (secure details stared out):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns0=
"https://adwords.google.com/api/adwords/o/v201609"; xmlns:ns1=
"http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns2=
"https://adwords.google.com/api/adwords/cm/v201609"; xmlns:tns=
"https://adwords.google.com/api/adwords/o/v201609"; xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance";>
   <SOAP-ENV:Header>
      <tns:RequestHeader>
         <tns:clientCustomerId xmlns:tns=
"https://adwords.google.com/api/adwords/cm/v201609";>**********
</tns:clientCustomerId>
         <tns:developerToken xmlns:tns=
"https://adwords.google.com/api/adwords/cm/v201609";>***********
</tns:developerToken>
         <tns:userAgent xmlns:tns=
"https://adwords.google.com/api/adwords/cm/v201609";>unknown (AwApi-Python, 
googleads/5.0.0, Python/2.7.13)</tns:userAgent>
         <tns:validateOnly xmlns:tns=
"https://adwords.google.com/api/adwords/cm/v201609";>false</tns:validateOnly>
         <tns:partialFailure xmlns:tns=
"https://adwords.google.com/api/adwords/cm/v201609";>false
</tns:partialFailure>
      </tns:RequestHeader>
   </SOAP-ENV:Header>
   <ns1:Body>
      <ns0:get>
         <ns0:selector>
            <ns0:campaignEstimateRequests>
               <ns0:adGroupEstimateRequests>
                  <ns0:keywordEstimateRequests>
                     <ns0:keyword>
                        <ns2:Criterion.Type>Keyword</ns2:Criterion.Type>
                        <ns2:text>mars cruise</ns2:text>
                        <ns2:matchType>BROAD</ns2:matchType>
                     </ns0:keyword>
                  </ns0:keywordEstimateRequests>
                  <ns0:keywordEstimateRequests>
                     <ns0:keyword>
                        <ns2:Criterion.Type>Keyword</ns2:Criterion.Type>
                        <ns2:text>cheap cruise</ns2:text>
                        <ns2:matchType>PHRASE</ns2:matchType>
                     </ns0:keyword>
                  </ns0:keywordEstimateRequests>
                  <ns0:keywordEstimateRequests>
                     <ns0:keyword>
                        <ns2:Criterion.Type>Keyword</ns2:Criterion.Type>
                        <ns2:text>cruise</ns2:text>
                        <ns2:matchType>EXACT</ns2:matchType>
                     </ns0:keyword>
                  </ns0:keywordEstimateRequests>
                  <ns0:keywordEstimateRequests>
                     <ns0:keyword>
                        <ns2:Criterion.Type>Keyword</ns2:Criterion.Type>
                        <ns2:text>moon walk</ns2:text>
                        <ns2:matchType>BROAD</ns2:matchType>
                     </ns0:keyword>
                     <ns0:isNegative>true</ns0:isNegative>
                  </ns0:keywordEstimateRequests>
                  <ns0:maxCpc>
                     <ns2:ComparableValue.Type>Money
</ns2:ComparableValue.Type>
                     <ns2:microAmount>1000000</ns2:microAmount>
                  </ns0:maxCpc>
               </ns0:adGroupEstimateRequests>
               <ns0:criteria xsi:type="ns2:Location">
                  <ns2:id>2840</ns2:id>
                  <ns2:Criterion.Type>Location</ns2:Criterion.Type>
               </ns0:criteria>
               <ns0:criteria xsi:type="ns2:Language">
                  <ns2:id>1000</ns2:id>
                  <ns2:Criterion.Type>Language</ns2:Criterion.Type>
               </ns0:criteria>
            </ns0:campaignEstimateRequests>
            <ns0:platformEstimateRequested>true
</ns0:platformEstimateRequested>
         </ns0:selector>
      </ns0:get>
   </ns1:Body>
</SOAP-ENV:Envelope>

Please help :). I don't know what I am doing wrong.

Cheers.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/4833d488-ed44-412a-bf41-7ac037a6c4dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to