]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 20 Jun 2023 19:59:46 +0000 (21:59 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 20 Jun 2023 19:59:46 +0000 (21:59 +0200)
- okay /api/top.json while the view is called /scoreboard, renamed it

api.py

diff --git a/api.py b/api.py
index 41e0589e13f8915607047ecab1993ab6f2325284..eb7a8f88a406ebe7038edcdea77d2c88b69730e7 100644 (file)
--- 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")