from sanic import response import subprocess def get_git_info(): branch_name = subprocess.check_output(["git", "branch", "--show-current"]).decode('utf-8').strip() commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode('utf-8').strip() return branch_name, commit_hash async def s_api_system_version(request): branch_name, commit_hash = get_git_info() return response.json({ "codebase_hash": commit_hash, "codebase_branch": branch_name, })