Пример #1
0
 def insertLog(self, date, host, url, client_ip, useragent, status):
     db = models()
     db.logs.insert(date=date,
                    url=url,
                    host=host,
                    client_ip=client_ip,
                    useragent=useragent,
                    status=status)
     db.commit()
Пример #2
0
 def checkBlacklist(self, host, url):
     db = models()
     result = db((db.blacklists.url == url)
                 | (db.blacklists.host == host)).select()
     return len(result)
Пример #3
0
 def getAllBlacklist(self, ):
     db = models()
     results = db().select(db.blacklists.ALL, orderby=~db.blacklists.id)
     return results
Пример #4
0
 def bulkInsertBlacklist(self, blacklists):
     db = models()
     for bl in blacklists:
         db.blacklists.update_or_insert(url=bl['url'], host=bl['host'])
     db.commit()
Пример #5
0
 def deleteBlacklist(self, bid):
     db = models()
     db(db.blacklists.id == bid).delete()
     db.commit()
Пример #6
0
 def insertBlacklist(self, url, host):
     db = models()
     db.blacklists.update_or_insert(url=url, host=host)
     db.commit()
Пример #7
0
 def getAllLogs(self, ):
     db = models()
     results = db().select(db.logs.ALL, orderby=~db.logs.id)
     return results