main
py 26 lines 659 Bytes
Raw
1 from helpers.api import ApiHandler, Request, Response
2 from helpers import errors, git
3
4 class HealthCheck(ApiHandler):
5
6 @classmethod
7 def requires_auth(cls) -> bool:
8 return False
9
10 @classmethod
11 def requires_csrf(cls) -> bool:
12 return False
13
14 @classmethod
15 def get_methods(cls) -> list[str]:
16 return ["GET", "POST"]
17
18 async def process(self, input: dict, request: Request) -> dict | Response:
19 gitinfo = None
20 error = None
21 try:
22 gitinfo = git.get_git_info()
23 except Exception as e:
24 error = errors.error_text(e)
25
26 return {"gitinfo": gitinfo, "error": error}