def main(client):
  # Initialize appropriate service.
  placement_service = client.GetService('PlacementService', version='v201505')

  # Create a statement to only select active placements.
  values = [{
      'key': 'status',
      'value': {
          'xsi_type': 'TextValue',
          'value': 'ACTIVE'
      }
  }]
  query = 'WHERE status = :status'
  statement = dfp.FilterStatement(query, values)

   # Get placements by statement.
  while True:
    response = placement_service.getPlacementsByStatement(
        statement.ToStatement())
    if 'results' in response:
      # Display results.
      for placement in response['results']:
        print ('Placement with id \'%s\' and name \'%s\' was found.'
               % (placement['id'], placement['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/v201505/placement_service/get_placements_by_statement.py/main/original