Flask Restful reqparse.RequestParser显示多个帮助消息

时间:2020-10-21 03:05:04

标签: flask-restful

parser.add_argument('price', location='json', type=float, required=True)

此处的价格为必需的浮动字段

2种不同情况下的当前错误:

"price": "Missing required parameter in the JSON body"

"price": "could not convert string to float: 'd'"

期望:

"price": "Price is required"

"price": "invalid price value"

现在,我想针对多种错误类型自定义多条消息

0 个答案:

没有答案