From c59671bf9117ec6f9160a6a9d52e3f8171223677 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 8 Jul 2023 02:28:47 +0200 Subject: [PATCH] Continued: - ops, wrong bait, wrong fish --- daemon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index 71e76ce..517e445 100755 --- a/daemon.py +++ b/daemon.py @@ -30,8 +30,8 @@ from fastapi.responses import PlainTextResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates -import uvicorn import requests +import uvicorn from fba import database from fba import utils @@ -350,14 +350,14 @@ def top(request: Request, mode: str, value: str, amount: int = config.get("api_l found = 0 blocklist = list() - if response is not None and response.ok and response.status_code >= 300 and len(response.text) > 0: + if response.ok and response.status_code == 200 and len(response.text) > 0: blocklist = response.json() format = config.get("timestamp_format") for block_level in blocklist: for row in blocklist[block_level]: row["first_seen"] = datetime.utcfromtimestamp(row["first_seen"]).strftime(format) - row["last_seen"] = datetime.utcfromtimestamp(row["last_seen"]).strftime(format) if isinstance(row["last_updated"], float) else None + row["last_seen"] = datetime.utcfromtimestamp(row["last_seen"]).strftime(format) if isinstance(row["last_seen"], float) else None found = found + 1 return templates.TemplateResponse("views/top.html", { -- 2.39.5