Good morning,
I'm trying to get more than 700 (the upper limit) keywords from the
TargetingIdeas Service. According to the available documentation, I should
be able to do so by increasing the "startIndex" parameter at each request,
but I can't get the code to work.
I'm doing the following: I'm targeting a specific CategoryId, requesting
500 at a time on the "numberResults" parameter, and then increse the
"startIndex" parameter by 500 each time.
This is not working, so I have just tried to set to 500 both parameters,
which should give me elements from 500 to 1000. But this is not the case,
as I only manage to get elements from 500 to 700, thus being unable to
overcome that limit...
The startIndex has clearly been modified, as I'm getting elements starting
from the 500, but for some reason the 700 limit is still there, as if this
700 limit wasn't a request limit, but a global limit.
Could you please help me? Here it is the code I have been using for this
last test:
PAGE_SIZE = 500
def main(client):
Categories = [10004]
for elem in Categories:
targeting_idea_service =
adwords_client.GetService('TargetingIdeaService', version='v201809')
# Construct selector
selector = {
'ideaType': 'KEYWORD',
'requestType': 'IDEAS'
}
selector['requestedAttributeTypes'] = [
'KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES',
'COMPETITION','AVERAGE_CPC']
offset = 500
selector['paging'] = {
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
}
selector['searchParameters'] = [{
'xsi_type': 'CategoryProductsAndServicesSearchParameter',
'categoryId': elem
}]
selector['searchParameters'].append({
'xsi_type': 'NetworkSearchParameter',
'networkSetting': {
'targetGoogleSearch': True,
'targetSearchNetwork': True,
'targetContentNetwork': False,
'targetPartnerSearchNetwork': True
}
})
selector['searchParameters'].append({
'xsi_type': 'LanguageSearchParameter',
'languages': [{'id': '1000'}] #English
})
selector['searchParameters'].append({
'xsi_type': 'LocationSearchParameter',
'locations': [{'id': '2840'}] # United States
})
for i in range(5):
try:
page = targeting_idea_service.get(selector)
break
except Exception as e:
print("ERROR: " + str(e))
time.sleep(30)
for result in page['entries']:
attributes = {}
for attribute in result['data']:
attributes[attribute['key']] = getattr(attribute['value'], 'value',
'0')
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/de7c920e-df39-4feb-a6f2-ee36aa5fd708n%40googlegroups.com.