#NEWLINE# def main( client ) : #NEWLINE# #INDENT# report_downloader = client . GetDataDownloader ( version = 'v201602' ) #NEWLINE# line_items_file = tempfile . NamedTemporaryFile ( prefix = 'line_items_' , suffix = '.csv' , mode = 'w' , delete = False ) #NEWLINE# ad_units_file = tempfile . NamedTemporaryFile ( prefix = 'ad_units_' , suffix = '.csv' , mode = 'w' , delete = False ) #NEWLINE# line_items_pql_query = 'SELECT Name, Id, Status FROM Line_Item ORDER BY Id ASC' #NEWLINE# ad_units_pql_query = 'SELECT Name, Id FROM Ad_Unit ORDER BY Id ASC' #NEWLINE# report_downloader . DownloadPqlResultToCsv ( line_items_pql_query , line_items_file ) #NEWLINE# report_downloader . DownloadPqlResultToCsv ( ad_units_pql_query , ad_units_file ) #NEWLINE# line_items_file . close ( ) #NEWLINE# ad_units_file . close ( ) #NEWLINE# print ( ( 'Saved line items to... %s' % line_items_file . name ) ) #NEWLINE# print ( ( 'Saved ad units to... %s' % ad_units_file . name ) )