def main(client):
  # Initialize appropriate service.
  suggested_ad_unit_service = client.GetService(
      'SuggestedAdUnitService', version='v201508')

  # Create a filter statement.
  statement = dfp.FilterStatement()

  # Get suggested ad units by statement.
  while True:
    response = suggested_ad_unit_service.getSuggestedAdUnitsByStatement(
        statement.ToStatement())
    if 'results' in response:
      # Display results.
      for suggested_ad_unit in response['results']:
        print ('Ad unit with id \'%s\' and number of requests \'%s\' was found.'
               % (suggested_ad_unit['id'], suggested_ad_unit['numRequests']))
      statement.offset += dfp.SUGGESTED_PAGE_LIMIT
    else:
      break

  print '\nNumber of results found: %s' % response['totalResultSetSize']
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201508/suggested_ad_unit_service/get_all_suggested_ad_units.py/main/original