summaryrefslogtreecommitdiff
path: root/swiftstory/status.py
blob: d794580356b563160b10971409d832f90d6b7544 (plain)
1
2
3
4
5
6
7
8
9
from typing import Any
import json


def error(msg: str, code: int = 255) -> str:
    return json.dumps({'type': 'response', 'content': {'status': code, 'info': msg}})

def success(obj: Any) -> str:
    return json.dumps({'type': 'response', 'content': {'status': 0, 'result': obj}})