def main(client):
  # Initialize a report downloader.
  report_downloader = client.GetDataDownloader(version='v201511')

  output_file = tempfile.NamedTemporaryFile(
      prefix='line_items_named_like_', suffix='.csv', mode='w', delete=False)

  # Create bind value to select line items with names starting with 'line item'.
  values = [{
      'key': 'name',
      'value': {
          'xsi_type': 'TextValue',
          'value': 'line item%'
      }
  }]

  pql_query = ('SELECT Name, Id, Status FROM Line_Item '
               'WHERE Name LIKE :name')

  # Downloads the response from PQL select statement to the specified file
  report_downloader.DownloadPqlResultToCsv(
      pql_query, output_file, values)
  output_file.close()

  print ('Saved line items to... %s' % output_file.name)
dataset/ETHPy150Open googleads/googleads-python-lib/examples/dfp/v201511/publisher_query_language_service/get_line_items_named_like.py/main/original