From e81256ae0ecf73006ad384c90ef487bb1616843d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Jun 2023 21:59:46 +0200 Subject: [PATCH] Continued: - okay /api/top.json while the view is called /scoreboard, renamed it --- api.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api.py b/api.py index 41e0589..eb7a8f8 100644 --- a/api.py +++ b/api.py @@ -51,8 +51,8 @@ def api_info(): "slogan" : config.get("slogan") } -@router.get(config.get("base_url") + "/api/top.json", response_class=JSONResponse) -def api_top(mode: str, amount: int): +@router.get(config.get("base_url") + "/api/scoreboard.json", response_class=JSONResponse) +def api_scoreboard(mode: str, amount: int): if amount > 500: raise HTTPException(status_code=400, detail="Too many results") @@ -163,19 +163,19 @@ def scoreboard(request: Request, mode: str, amount: int): response = None if mode == "blocker" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=blocker&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=blocker&amount={amount}") elif mode == "blocked" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=blocked&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=blocked&amount={amount}") elif mode == "reference" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=reference&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=reference&amount={amount}") elif mode == "software" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=software&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=software&amount={amount}") elif mode == "command" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=command&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=command&amount={amount}") elif mode == "error_code" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=error_code&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=error_code&amount={amount}") elif mode == "avg_peers" and amount > 0: - response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/top.json?mode=avg_peers&amount={amount}") + response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/scoreboard.json?mode=avg_peers&amount={amount}") else: raise HTTPException(status_code=400, detail="No filter specified") -- 2.39.5