1 回答

TA贡献1796条经验 获得超10个赞
@ns.route("/dev/get_rec_id", methods=["POST"])
@ns.param('mine_id', 'unique ECP ID')
class RecommendationService(Resource):
@ns.doc('path to generate a unique recommendationid, and to determine which frames predictions can be made for. Expected/optional input : JSON string as a https html data objects with keys: mine_id -- unique ECP ID. If this is not provided generic frames recommendations will be provided.')
@ns.marshal_list_with(myModel)
def post(self):
mine_id = np.nan
if request.is_json:
mine_id = request.json.get('mine_id', np.nan)
return {'rec_id': np.random.choice(1000),
'fun_id_prob': [[1, 0.1], [2, 0.1], [3, 0.1], [4, 0.1], [5, 0.6]],
'comment': 'these games suit everyone',
'mine_id': mine_id
}
在此签名不匹配即fun_id_prob不在 API 签名中,也由于某种原因在调用X-Fields时,它需要保持为空。
只需使用
@ns.route("/dev/get_rec_id", methods=["POST"])
@ns.param('mine_id', 'unique ECP ID')
class RecommendationService(Resource):
@ns.doc('path to generate a unique recommendationid, and to determine which frames predictions can be made for. Expected/optional input : JSON string as a https html data objects with keys: mine_id -- unique ECP ID. If this is not provided generic frames recommendations will be provided.')
@ns.marshal_list_with(myModel)
def post(self):
mine_id = np.nan
if request.is_json:
mine_id = request.json.get('mine_id', np.nan)
return {'rec_id': np.random.choice(1000),
'comment': 'these games suit everyone',
'mine_id': mine_id
}
或将列表添加到签名中,它将起作用:)。
添加回答
举报