(self)
return ispReport
Get the statistics by ISP (Internet Service Provider)
Get the statistics by ISP (Internet Service Provider)
Get the statistics by ISP ( Internet Service Provider )
def reportByProvider(self):
        """Get the statistics by ISP (Internet Service Provider)"""
        condition = "unixtime > '{}%' and provider != 'private'".format(self.periodFilter)
        timeColumns = "count(ip) as count," + self.dateColumns
        group = "group by provider"
        order = "order by count desc"
        query = "select provider,countryName,{} from connections where {} {} {}".format(
            timeColumns, condition, group, order)
        cursor = self.conn.execute(query)

        ispReport = []

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

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