From: Roland Häder Date: Sat, 8 Jul 2023 00:28:47 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c59671bf9117ec6f9160a6a9d52e3f8171223677;p=fba.git Continued: - ops, wrong bait, wrong fish --- 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", {