def main(client):
  # Initialize appropriate service.
  product_template_service = client.GetService(
      'ProductTemplateService', version='v201602')

  # Create a filter statement.
  statement = dfp.FilterStatement('ORDER BY id ASC')

  # Get product templates by statement.
  while True:
    response = product_template_service.getProductTemplatesByStatement(
        statement.ToStatement())
    if 'results' in response:
      # Display results.
      for product_template in response['results']:
        print ('Product template with id \'%s\' and name \'%s\' was found.' % (
            product_template['id'], product_template['name']))
      statement.offset += dfp.SUGGESTED_PAGE_LIMIT
    else:
      break

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