def serialized(obj, status=200):
fmt = get_serializer()
if fmt == 'json':
ser = json.dumps
ct = 'application/json'
elif fmt == 'yaml':
ser = yaml.safe_dump
ct = 'text/plain+yaml' # For interop with browsers
elif fmt is None:
return None
else:
abort(404)
data = ser(obj)
resp = make_response(data, 200)
resp.headers['Content-Type'] = ct
return resp
# Authentication
评论列表
文章目录