@router.get(config.get("base_url") + "/api/scoreboard.json", response_class=JSONResponse)
def api_scoreboard(mode: str, amount: int):
- if amount > 500:
+ if amount > config.get("api_limit"):
raise HTTPException(status_code=400, detail="Too many results")
if mode == "blocked":
def api_index(request: Request, mode: str, value: str, amount: int):
if mode is None or value is None or amount is None:
raise HTTPException(status_code=500, detail="No filter specified")
- elif amount > 500:
+ elif amount > config.get("api_limit"):
raise HTTPException(status_code=500, detail=f"amount={amount} is to big")
domain = whildchar = punycode = reason = None
})
@router.get(config.get("base_url") + "/top")
-def top(request: Request, mode: str, value: str, amount: int = 500):
+def top(request: Request, mode: str, value: str, amount: int = config.get("api_limit")):
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/info.json")
if not response.ok:
raise HTTPException(status_code=response.status_code, detail=response.text)
elif mode == "" or value == "" or amount == 0:
raise HTTPException(status_code=500, detail="Parameter mode, value and amount must always be set")
- elif amount > 500:
+ elif amount > config.get("api_limit"):
raise HTTPException(status_code=500, detail=f"amount='{amount}' is to big")
info = response.json()