HTTPError: Internal Server Error when accessing Google Adword API (Python)

264 views
Skip to first unread message

Peng Liu

unread,
Jan 17, 2017, 10:00:20 AM1/17/17
to AdWords API Forum
Hi, 

I am new to google adword api. 

I have configured the YAML file as instructed and installed the python client library for google adword api. However When i tried to run the sample code for generating keyword ideas. I have encountered this error:

Traceback (most recent call last):

  File "<ipython-input-1-28349b00a211>", line 1, in <module>
    runfile('C:/Users/ASUS/Documents/GitHub/FYP_data_analysis/google/keyword_idea generation_api_google.py', wdir='C:/Users/ASUS/Documents/GitHub/FYP_data_analysis/google')

  File "C:\Anaconda3\envs\py27\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda3\envs\py27\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/ASUS/Documents/GitHub/FYP_data_analysis/google/keyword_idea generation_api_google.py", line 120, in <module>
    retrieveKeywordIdea(adwords_client, words)

  File "C:/Users/ASUS/Documents/GitHub/FYP_data_analysis/google/keyword_idea generation_api_google.py", line 90, in retrieveKeywordIdea
    page = targeting_idea_service.get(selector)

  File "build\bdist.win-amd64\egg\googleads\common.py", line 700, in MakeSoapRequest
    *[_PackForSuds(arg, self.suds_client.factory) for arg in args])

  File "C:\Anaconda3\envs\py27\lib\site-packages\suds\client.py", line 521, in __call__
    return client.invoke(args, kwargs)

  File "C:\Anaconda3\envs\py27\lib\site-packages\suds\client.py", line 581, in invoke
    result = self.send(soapenv)

  File "C:\Anaconda3\envs\py27\lib\site-packages\suds\client.py", line 613, in send
    reply = self.options.transport.send(request)

  File "build\bdist.win-amd64\egg\googleads\util.py", line 98, in PatchedHttpTransportSend
    fp = self.u2open(u2request)

  File "C:\Anaconda3\envs\py27\lib\site-packages\suds\transport\http.py", line 132, in u2open
    return url.open(u2request, timeout=tm)

  File "C:\Anaconda3\envs\py27\lib\urllib2.py", line 435, in open
    response = meth(req, response)

  File "C:\Anaconda3\envs\py27\lib\urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)

  File "C:\Anaconda3\envs\py27\lib\urllib2.py", line 473, in error
    return self._call_chain(*args)

  File "C:\Anaconda3\envs\py27\lib\urllib2.py", line 407, in _call_chain
    result = func(*args)

  File "C:\Anaconda3\envs\py27\lib\urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

HTTPError: Internal Server Error

This is the traceback to the error. 

I hope anyone can enlight me on this matter. Thanks a lot. 

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 17, 2017, 11:51:07 AM1/17/17
to AdWords API Forum
Hi Peng,

The internal server errors are usually transient in nature. If this persists, could you please use the reply privately to author option and share with me a sample SOAP request along with response logs when you are getting this error so that I can take a closer look?

If you don't have logging enabled, you can do so by following these instructions.

Thanks,
Sreelakshmi, AdWords API Team

Markus Sørensen

unread,
Jan 23, 2017, 9:04:22 AM1/23/17
to AdWords API Forum
Hi,

Has this been solved?
I am having the exact same problem, trying to make a request using the template for get_campaigns via the python library.
Just started working with AdWords API, but thinking the template at least should work :)

Best regards, 
Markus

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jan 23, 2017, 12:18:24 PM1/23/17
to adwor...@googlegroups.com
Hi Markus, 

Could you confirm that your SOAP request has the 'clientCustomerId' populated? The client customer Id is mandatory and any request missing this field will fail. If that is missing, you could either update the client customer Id in your googleads.yaml file (set the 'client_customer_id' and uncomment that line) or you could set that at the run time as specified here

If your request has clientCustomerId populated, please use 'reply privately to author' and send me your SOAP request and response. Please check the earlier thread if you need instructions to enable logging. 

giancampo

unread,
Feb 2, 2017, 9:10:58 AM2/2/17
to AdWords API Forum
Hello Peng Liu,
I just want to share what happed to me.

I encountered the same problem of you, and got in touch with an AdWords API Advisor (Sreelakshmi) who helped me solving it.

In my case, the problem was really a dumb thing: I forgot to insert a Developer Token into the googleads.yaml.
So, m y suggestion is to first check out that Developer Token, Client ID, Client Secret and Refresh Token are populated in your googleads.yaml.

If this is not your case you should implement three rows of code in the script you have written:
  1. import logging

    in the beginning of the script

  2. logging.basicConfig(level=logging.INFO)
    logging
    .getLogger('suds.transport').setLevel(logging.DEBUG)
    right after the rows where you import libraries. Look at a sample here.
This lets you report the SOAP logs that are necessary to the AdWords API Team in order to help you.

vivian...@belezanaweb.com.br

unread,
Jun 27, 2017, 10:32:42 AM6/27/17
to AdWords API Forum
Guys I'm having the same problem, but i already filled the fields client_customer_id, developer_token, client_id, client_secret and refresh_token on the yaml file. Can you give me some help with this? I already have the logging turned on.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jun 27, 2017, 3:47:53 PM6/27/17
to AdWords API Forum
Hi Viviane, 

Could you please pass me your SOAP logs (request and response) so that I can take a look? Also, confirm the version of python client library that you are using. 
Reply all
Reply to author
Forward
0 new messages