RateExceededError How can I solve this error?

208 views
Skip to first unread message

Milan Karsten

unread,
Nov 9, 2017, 8:27:26 AM11/9/17
to AdWords API Forum
Hi,

When trying to generate keyword suggestions and extract volume for just 5 keyword I keep running into the error below:
suds.WebFault: Server raised fault: '[RateExceededError <rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30>]'

Can someone explain me what the error means exactly? I can not find any documentation on the rateName = Rate_LIMIT exception. Only on RateName = RequestsPerMinute.

I am not an experienced python programmer, and as such I have build a script that takes one keyword as input and outputs the search volume for that keyword. Is it also possible to enter a list of keywords and get a list of search volumes out? Would this also help to solve the problem with the RateExceededError? See my code below.

Lastly, I read about that one can solve this error by building a throttling algorithm. Could someone give me a rough idea how such a algorithm would work for the script below?

I have a basic acces level for the API

Many thanks!






PAGE_SIZE = 1

def __init__(self, client):
self.client = client

# Construct selector object and retrieve related keywords.
self.selector = {
'ideaType': 'KEYWORD',
'requestType': 'STATS'
}

self.selector['requestedAttributeTypes'] = ['SEARCH_VOLUME']

self.selector['paging'] = {
'startIndex': str(0),
'numberResults': str(self.PAGE_SIZE)
}

self.selector['searchParameters'] = [{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries': ['space cruise']
}]

# Language setting (optional).
self.selector['searchParameters'].append({
'xsi_type': 'LanguageSearchParameter',
'languages': [{'id': '1010'}]
})

# Network search parameter (optional)
self.selector['searchParameters'].append({
'xsi_type': 'NetworkSearchParameter',
'networkSetting': {
'targetGoogleSearch': True,
'targetSearchNetwork': False,
'targetContentNetwork': False,
'targetPartnerSearchNetwork': False
}
})
#


def set_query(self, query_str):
"""Set the query_str

query_str -- a string or array of strings
"""
self.selector['searchParameters'] = [{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries':
query_str if isinstance(query_str, list) else [query_str]
}]

def set_language(self, language_code):
# Language setting (optional).
self.selector['searchParameters'].append({
# The ID can be found in the documentation:
# https://developers.google.com/adwords/api/docs/appendix/languagecodes
# see languagecodes.csv
'xsi_type': 'LanguageSearchParameter',
'languages': [{'id': language_code}]
})

def set_ad_group_id(self, ad_group_id):
self.selector['searchParameters'].append({
'xsi_type': 'SeedAdGroupIdSearchParameter',
'adGroupId': ad_group_id
})

@property
def get_search_volume(self):
self.targeting_idea_service = self.client.GetService(
'TargetingIdeaService', version='v201710')
page = self.targeting_idea_service.get(self.selector)
if 'entries' in page:
for result in page['entries']:
attributes = {}
for attribute in result['data']:
attributes[attribute['key']] = getattr(
attribute['value'], 'value', '0')

return attributes['SEARCH_VOLUME']

Bharani Cherukuri (AdWords API Team)

unread,
Nov 9, 2017, 2:25:20 PM11/9/17
to AdWords API Forum
Hi Milan, 

The RateExceededError is usually experienced when there are too many requests made to the API in a short period of time. Since the rateScope here is ACCOUNT, it indicates that the limit has been applied when an application makes high number of requests on a single AdWords account and may trigger this error for exceeding that limit. You'll need to wait for the amount of time specified in the retryAfterSeconds parameter before retrying the request. This said, you can mitigate this error by taking a control of your application by following some of the strategies mentioned here.

Additionally, you can query for multiple keywords in a single get request and it would be considered as one operation. You may refer to the Batch targeting ideas and the rate limits documentation for further reference. 

Regards,
Bharani, AdWords API Team
Reply all
Reply to author
Forward
0 new messages