Ejemplo n.º 1
0
class GetLogIpAreaHandler(web.RequestHandler):
    def initialize(self,logger):
        self.logger = logger
        self.redis_conf = DBConfInstance.getRedisInstance("tlogdata")
        self.logger.info(" redis_conf=[%s]",self.redis_conf)
        self.redis_conn = RedisOper(logger, self.redis_conf)
        
    def get(self, str):
        str = str.replace('^','&').replace('*','|')
        self.logger.info(" get request info=[%s]",str)
        if str is None:
            raise web.HTTPError(404)
            self.clear()
        else:
            res,area=self.get_result_status(str)
            if res is True:
                self.write("ok")
            else:
                self.write("no")
                

    def get_result_status(self,str):
        #1&10.206.15.211&2013-08-28_08|2013-08-28_09&1&1
        #str=area + "&" + ip + "&" + vFieldInterval + "&" + 1 + "&" + 1
        result = self.redis_conn.query_hash_key_fields(str)
        if result:
            self.logger.info(" get result=[%s]",result[0])
            return True,result[0]
        else:
            return False,False
Ejemplo n.º 2
0
 def initialize(self,logger):
     self.logger = logger
     self.redis_conf = DBConfInstance.getRedisInstance("tlogdata")
     self.logger.info(" redis_conf=[%s]",self.redis_conf)
     self.redis_conn = RedisOper(logger, self.redis_conf)