TypeNotFound: Type not found: 'DateRange':
This is my script. Please help
from googleads import adwords
PAGE_SIZE = 100
start_date = '20140101'
end_date = '20140101'
def main(client):
# Initialize appropriate service.
targeting_idea_service = client.GetService(
'TargetingIdeaService', version='v201702')
# Construct selector object and retrieve related keywords.
offset = 0
selector = {
'searchParameters': [
{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries': ['TRUMP DUMP']
},
{
# Language setting (optional).
# The ID can be found in the documentation:
# https://developers.google.com/adwords/api/docs/appendix/languagecodes
'xsi_type': 'LanguageSearchParameter',
'languages': [{'id': '1000'}]
},
{
# Network search parameter (optional)
'xsi_type': 'NetworkSearchParameter',
'networkSetting': {
'targetGoogleSearch': True,
'targetSearchNetwork': False,
'targetContentNetwork': False,
'targetPartnerSearchNetwork': False
}
}
],
'ideaType': 'KEYWORD',
'requestType': 'STATS',
'requestedAttributeTypes': ['KEYWORD_TEXT', 'SEARCH_VOLUME',
'TARGETED_MONTHLY_SEARCHES'],
'paging': {
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
},
'DateRange':{
'min': '20140101',
'max': '20170101'
}
}
more_pages = True
while more_pages:
page = targeting_idea_service.get(selector)
# Display results.
if 'entries' in page:
for result in page['entries']:
attributes = {}
for attribute in result['data']:
attributes[attribute['key']] = getattr(attribute['value'], 'value',
'0')
print ('Keyword with \'%s\' text and average monthly search volume '
'\'%s\' was found with Products and Services categories: %s.'
% (attributes['KEYWORD_TEXT'],
attributes['SEARCH_VOLUME'],
attributes['TARGETED_MONTHLY_SEARCHES']))
print
else:
print 'No related keywords were found.'
offset += PAGE_SIZE
selector['paging']['startIndex'] = str(offset)
more_pages = offset < int(page['totalNumEntries'])
if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()
main(adwords_client)
Thank you for reading this far. This email may be *confidential* or *privileged*. If you received this communication by mistake, please don't forward it to anyone else. Please erase all copies and attachments, and let me know that it went to the wrong person.