diff options
Diffstat (limited to 'swiftstory/status.py')
-rw-r--r-- | swiftstory/status.py | 4 |
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}}) |