]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2023 00:28:47 +0000 (02:28 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2023 00:28:47 +0000 (02:28 +0200)
- ops, wrong bait, wrong fish

daemon.py

index 71e76cef28cd5536eadd630631adc9b09d3931f6..517e445e9aaeae317be588fd16d77910e9ee0596 100755 (executable)
--- 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", {