def get(self): waiting = conn.lrange("waiting", 0, 15) running = conn.lrange("running", 0, 15) finished = conn.lrange("finished", 0, 15) vulnerable = conn.lrange("vulnerable", 0, 15) self.render("index.html", waiting_num=conn.llen("waiting"), running_num=conn.llen("running"), finished_num=conn.llen("finished"), vulnerable_num=conn.llen("vulnerable"), waiting=waiting, running=running, finished=finished, vulnerable=vulnerable, time=config.load()["flush_time"]) return
def get(self): list_type = self.get_argument("type") try: start = int(self.get_argument("start")) except: start = 0 page_num = int(config.load()['page_num']) length = conn.llen(list_type) last = start + page_num - 1 page_now = start / page_num + 1 end_page = -1 * ((-1 * length) / page_num) end_num = end_page * page_num - page_num if page_now - 2 >= 1: pages_first = page_now - 2 else: pages_first = 1 if page_now + 2 <= end_page: pages_last = page_now + 2 else: pages_last = end_page pages = range(pages_first, pages_last + 1) content = conn.lrange(list_type, start, last) req_content = {} for reqhash in content: request_content = json.loads( base64.b64decode(conn.hget("request", reqhash))) req_content[reqhash] = request_content[ 'method'] + "|" + request_content['url'] return self.render("list.html", page_now=page_now, page_num=page_num, pages=pages, content=content, list_type=list_type, length=length, req_content=req_content, end_num=end_num)