TrafficEstimatorService: HTTP Error 500: Internal Server Error

218 views
Skip to first unread message

Mitchell Eccles

unread,
Feb 13, 2017, 4:09:48 AM2/13/17
to AdWords API Forum
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:


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.

Shwetha Vastrad (AdWords API Team)

unread,
Feb 13, 2017, 2:05:19 PM2/13/17
to AdWords API Forum
Hi Mitchell,

Could you provide the email address used to authenticate the API request along with the clientCustomerId specified in the request header? Is the account specified by the clientCustomerId a test account? A developer token with test access can only be used to target test accounts. To start using your developer token with your production account, you'll need to apply for basic access by filling out this application form. The AdWords API compliance team will respond in a couple of days. While you wait for your developer token to get approved, you can start using the API with test accounts

If you still encounter errors with a test account, could you send over the SOAP request and response logs, so I can take a look? Please use Reply privately to author when responding. 

Regards,
Shwetha, AdWords API Team.
Message has been deleted

Gustavo Mora Gonzalez

unread,
Feb 13, 2017, 2:35:28 PM2/13/17
to AdWords API Forum
After a long research I found this issue on github, downgrade the version of googleads to 4.7.0 and run the example file again, the response show the error.
In the 5.0.0 version only response with 500 code

Shwetha Vastrad (AdWords API Team)

unread,
Feb 13, 2017, 5:41:19 PM2/13/17
to AdWords API Forum
Hi Gustavo,

Glad to hear that you could figure out the source of the error. Please keep an eye on the github issue to be updated once the issue is resolved.

Mitchell, could you let me know if you still face this issue? 

Thanks,
Shwetha, AdWords API Team.

Mitchell Eccles

unread,
Apr 9, 2017, 2:48:36 PM4/9/17
to AdWords API Forum
Hi Gustavo,

Sorry for the slow reply. Thank you very much for looking into this issue for me. As so much time has passed since I initially posted, I have been able to resolve this by updating to version 5.3.0, where the issue you mention has been fixed.

Cheers,
Mitch
Reply all
Reply to author
Forward
0 new messages