swagger_server.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:falsy 作者: pingf 项目源码 文件源码
def default_error_handler(req, resp, e):
    resp.body = json.dumps({'title': str(type(e)), 'description': str(e)}, indent=2, ensure_ascii=False)
    resp.status = falcon.HTTP_500
    resp.content_type = 'application/json'


# def http_not_found_handler(req, resp, e):
#     resp.body = e.title
#     resp.status = e.status
#     resp.content_type = 'application/json'
#
#
# def http_missing_param_handler(req, resp, e):
#     resp.body = json.dumps({'error': e.title + ':' + ' '.join([p for p in e.args])})
#     resp.status = e.status
#     resp.content_type = 'application/json'
#
#
# def http_invalid_param_handler(req, resp, e):
#     resp.body = json.dumps({'error': e.title + ':' + ' '.join([p for p in e.args])})
#     resp.status = e.status
#     resp.content_type = 'application/json'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号