def GetCustomerIDs(client):
 managed_customer_service = client.GetService('ManagedCustomerService', version='v201607')
 offset = 0
 selector = {'fields': ['CustomerId'], 'predicates': [{'field': 'CanManageClients', 'operator': 'EQUALS', 'values': [False]}], 'paging': {'startIndex': str(offset), 'numberResults': str(PAGE_SIZE)}}
 queue = multiprocessing.Queue()
 more_pages = True
 while more_pages:
  page = managed_customer_service.get(selector)
  if (page and ('entries' in page) and page['entries']):
   for entry in page['entries']:
    queue.put(entry['customerId'])
  else:
   raise Exception("Can't retrieve any customer ID.")
  offset += PAGE_SIZE
  selector['paging']['startIndex'] = str(offset)
  more_pages = (offset < int(page['totalNumEntries']))
 return queue

def GetCustomerIDs ( client ) : managed_customer_service = client . GetService ( 'ManagedCustomerService' , version = 'v201607' ) offset = 0 selector = { 'fields' : [ 'CustomerId' ] , 'predicates' : [ { 'field' : 'CanManageClients' , 'operator' : 'EQUALS' , 'values' : [ False ] } ] , 'paging' : { 'startIndex' : str ( offset ) , 'numberResults' : str ( PAGE_SIZE ) } } queue = multiprocessing . Queue ( ) more_pages = True while more_pages : page = managed_customer_service . get ( selector ) if ( page and ( 'entries' in page ) and page [ 'entries' ] ) : for entry in page [ 'entries' ] : queue . put ( entry [ 'customerId' ] ) else : raise Exception ( "Can't retrieve any customer ID." ) offset += PAGE_SIZE selector [ 'paging' ] [ 'startIndex' ] = str ( offset ) more_pages = ( offset < int ( page [ 'totalNumEntries' ] ) ) return queue
retrieves all customerids in the account hierarchy .