From: Roland Häder Date: Sun, 11 Jun 2023 22:02:46 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4ea64b14b1c68292d5bb62c613ec2caef6852be8;p=fba.git Continued: - avoid local variables --- 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") }