def main(client):
  # Initialize appropriate service.
  workflow_request_service = client.GetService('WorkflowRequestService',
                                               version='v201511')

  # Create statement object to select all workflow approval requests.
  values = [{
      'key': 'type',
      'value': {
          'xsi_type': 'TextValue',
          'value': 'WORKFLOW_APPROVAL_REQUEST'
      }
  }]
  query = 'WHERE type = :type'

  statement = dfp.FilterStatement(query, values)

  # Get proposals by statement.
  while True:
    response = workflow_request_service.getWorkflowRequestsByStatement(
        statement.ToStatement())
    if 'results' in response:
      # Display results.
      for workflow_request in response['results']:
        print ('Workflow approval request with id \'%s\' for %s with id \'%s\' '
               'was found.' % (workflow_request['id'],
                               workflow_request['entityType'],
                               workflow_request['entityId']))
      statement.offset += dfp.SUGGESTED_PAGE_LIMIT
    else:
      break

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