summaryrefslogtreecommitdiff
path: root/swiftstory/status.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-12-29 19:21:45 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-12-29 20:06:14 +0100
commit741f8234edde84dccefcbf5dc0ba3b70c0e016e2 (patch)
treec6207bfd9c20eeac59bea2ffef5d4fad70108c29 /swiftstory/status.py
parentf5edd5035d06adc7b6bceb1f521b4911706cde0b (diff)
Add docstrings to all modules
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/status.py')
-rw-r--r--swiftstory/status.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/swiftstory/status.py b/swiftstory/status.py
index d794580..a35f66a 100644
--- a/swiftstory/status.py
+++ b/swiftstory/status.py
@@ -1,9 +1,13 @@
+""" Module defining helpers to craft answers to be sent to clients. """
+
from typing import Any
import json
def error(msg: str, code: int = 255) -> str:
+ """ Generate an error. """
return json.dumps({'type': 'response', 'content': {'status': code, 'info': msg}})
def success(obj: Any) -> str:
+ """ Generate a success message. """
return json.dumps({'type': 'response', 'content': {'status': 0, 'result': obj}})