MCPcopy Create free account
hub / github.com/cppla/ServerStatus / validate_server

Function validate_server

server/manage_api.py:63–71  ·  view source on GitHub ↗
(server, index=None)

Source from the content-addressed store, hash-verified

61
62
63def validate_server(server, index=None):
64 if not isinstance(server, dict):
65 raise ApiError(400, "server must be an object", {"index": index})
66 required = ["username", "name", "type", "host", "location", "password"]
67 normalized = normalize_required_strings(server, required, "server", index=index)
68 normalized["monthstart"] = normalize_int(normalized.get("monthstart"), "monthstart", index=index, default=1, min_value=1, max_value=28)
69 if "disabled" in normalized:
70 normalized["disabled"] = bool(normalized["disabled"])
71 return normalized
72
73
74def validate_monitor(monitor, index=None):

Callers 1

routeMethod · 0.85

Calls 3

ApiErrorClass · 0.85
normalize_intFunction · 0.85

Tested by

no test coverage detected