]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 11 Jun 2023 22:02:46 +0000 (00:02 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 11 Jun 2023 22:02:46 +0000 (00:02 +0200)
- avoid local variables

api.py

diff --git a/api.py b/api.py
index 3ee3c5c49aaf5926bdb0d352e3b11176619f522b..70d7211802064f2043dfd32767ff112667eeb3ca 100644 (file)
--- a/api.py
+++ b/api.py
@@ -39,13 +39,13 @@ templates = Jinja2Templates(directory="templates")
 @router.get(config.get("base_url") + "/api/info.json", response_class=JSONResponse)
 def api_info():
     fba.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances), (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'misskey', 'friendica', 'bookwyrm', 'takahe', 'peertube')), (SELECT COUNT(blocker) FROM blocks), (SELECT COUNT(domain) FROM instances WHERE last_status_code IS NOT NULL)")
-    known, indexed, blocklist, errorous = fba.cursor.fetchone()
+    row = fba.cursor.fetchone()
 
     return {
-        "known_instances"   : known,
-        "indexed_instances" : indexed,
-        "blocks_recorded"   : blocklist,
-        "errorous_instances": errorous,
+        "known_instances"   : row[0],
+        "indexed_instances" : row[1],
+        "blocks_recorded"   : row[2],
+        "errorous_instances": row[3],
         "slogan"            : config.get("slogan")
     }