#NEWLINE# def main( credentials , data_set_config , query , options , start_at , end_at ) : #NEWLINE# #INDENT# credentials = credentials #NEWLINE# client = create_client ( credentials ) #NEWLINE# collapse_key = 'pageTitle' #NEWLINE# ( start , middle , end ) = get_date ( ) #NEWLINE# data = query_ga ( client , end , query , start ) #NEWLINE# collapsed_data = sum_data ( data , query [ 'metric' ] , collapse_key , ( start , middle , end ) , 500 ) #NEWLINE# trended_data = get_trends ( collapsed_data ) #NEWLINE# flattened_data = flatten_data_and_assign_ids ( trended_data ) #NEWLINE# data_set = DataSet . from_config ( data_set_config ) #NEWLINE# data_set . empty_data_set ( ) #NEWLINE# data_set . post ( flattened_data )