scripts/get_traffic.py
def write_data_to_file(self, file_path='', date=str(datetime.date.today()),
        organization='llnl',dict_to_write={}, name='', row_count=0):
        """
        Writes given dict to file.
        """
        exists = os.path.isfile(file_path)
        with open(file_path, 'a') as out:
            if not exists:
                out.write('date,organization,' + name + ',unique_' + name
                + ',id\n')
            sorted_dict = sorted(dict_to_write)
            for day in sorted_dict:
                day_formatted = datetime.datetime.utcfromtimestamp(
                    day ).strftime('%Y-%m-%d')
                out.write(day_formatted + ',' + organization + ','
                    + str(dict_to_write[day][0]) + ',' + str(dict_to_write[day][1])
                    + ',' + str(row_count) + '\n')
                row_count += 1
def write_data_to_file(self, file_path='', date=str(datetime.date.today()),
        organization='llnl',dict_to_write={}, name='', row_count=0):
        exists = os.path.isfile(file_path)
        with open(file_path, 'a') as out:
            if not exists:
                out.write('date,organization,' + name + ',unique_' + name
                + ',id\n')
            sorted_dict = sorted(dict_to_write)
            for day in sorted_dict:
                day_formatted = datetime.datetime.utcfromtimestamp(
                    day ).strftime('%Y-%m-%d')
                out.write(day_formatted + ',' + organization + ','
                    + str(dict_to_write[day][0]) + ',' + str(dict_to_write[day][1])
                    + ',' + str(row_count) + '\n')
                row_count += 1
def write_data_to_file ( self , file_path = '' , date = str ( datetime . date . today ( ) ) , organization = 'llnl' , dict_to_write = { } , name = '' , row_count = 0 ) : exists = os . path . isfile ( file_path ) with open ( file_path , 'a' ) as out : if not exists : out . write ( 'date,organization,' + name + ',unique_' + name + ',id\n' ) sorted_dict = sorted ( dict_to_write ) for day in sorted_dict : day_formatted = datetime . datetime . utcfromtimestamp ( day ) . strftime ( '%Y-%m-%d' ) out . write ( day_formatted + ',' + organization + ',' + str ( dict_to_write [ day ] [ 0 ] ) + ',' + str ( dict_to_write [ day ] [ 1 ] ) + ',' + str ( row_count ) + '\n' ) row_count += 1
Writes given dict to file.
Writes given dict to file .