From 4ea64b14b1c68292d5bb62c613ec2caef6852be8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 12 Jun 2023 00:02:46 +0200 Subject: [PATCH] Continued: - avoid local variables --- api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api.py b/api.py index 3ee3c5c..70d7211 100644 --- 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") } -- 2.39.5