I have a long list of geographical locations which I would like to add to a 
campaign.  I would like to read from a list of zip codes, look up the 
criteria ID for each one, and add them all to a campaign. The bit of python 
code which does the ID lookup looks like this:

def find_ids(client):
  location_criterion_service = client.GetService(
      'LocationCriterionService', version='v201402')
  
  with open('zip_codes.txt') as temp_file:
    location_names = [line.rstrip('\n') for line in temp_file]

  selector = {
      'fields': ['Id', 'LocationName'],
      'predicates': [{
          'field': 'LocationName',
          'operator': 'IN',
          'values': location_names
      }, {
          'field': 'Locale',
          'operator': 'EQUALS',
          'values': ['en']
      }]
  }

  location_criteria = location_criterion_service.get(selector)

It works as long as the list of zip codes is no longer than 25. Any longer 
and it throws an error: 

SizeLimitError.REQUEST_SIZE_LIMIT_EXCEEDED @ locationName; trigger:'25'

Is there a better way to do this, or do I need to set up a batching loop? 

Thanks very much for any help.

- Steve Renaker

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a54f1db6-2854-47af-b208-b74aba87e2ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to