(self)
return statusReport
Return access by status OK, Warning, Error
Return access by status OK, Warning, Error
Return access by status OK Warning Error
def reportByStatus(self):
        """Return access by status OK, Warning, Error"""
        condition = "unixtime > '{}%' and status != 'OK'".format(self.periodFilter)
        timeColumns = "count(ip) as count," + self.dateColumns
        group = "group by status,ip"
        order = "order by count desc"
        query = "select status,ip,{} from connections where {} {} {}".format(
            timeColumns, condition, group, order)
        cursor = self.conn.execute(query)

        statusReport = []

        for row in cursor:
            line = {}
            line['status'] = row[0]
            line['ip'] = row[1]
            line['nbConnections'] = row[2]
            line['from-date'] = row[3]
            line['till-date'] = row[4]
            statusReport.append(line)

        return statusReport
def reportByStatus ( self ) : condition = "unixtime > '{}%' and status != 'OK'" . format ( self . periodFilter ) timeColumns = "count(ip) as count," + self . dateColumns group = "group by status,ip" order = "order by count desc" query = "select status,ip,{} from connections where {} {} {}" . format ( timeColumns , condition , group , order ) cursor = self . conn . execute ( query ) statusReport = [ ] for row in cursor : line = { } line [ 'status' ] = row [ 0 ] line [ 'ip' ] = row [ 1 ] line [ 'nbConnections' ] = row [ 2 ] line [ 'from-date' ] = row [ 3 ] line [ 'till-date' ] = row [ 4 ] statusReport . append ( line ) return statusReport