basic redfish api

This commit is contained in:
Devaev Maxim
2020-09-28 02:41:46 +03:00
parent 7e874b035d
commit ccab97a56f
4 changed files with 143 additions and 3 deletions

View File

@@ -117,13 +117,14 @@ def make_json_response(
result: Optional[Dict]=None,
status: int=200,
set_cookies: Optional[Dict[str, str]]=None,
wrap_result: bool=True,
) -> aiohttp.web.Response:
response = aiohttp.web.Response(
text=json.dumps({
text=json.dumps(({
"ok": (status == 200),
"result": (result or {}),
}, sort_keys=True, indent=4),
} if wrap_result else result), sort_keys=True, indent=4),
status=status,
content_type="application/json",
)