我有以下继承自flask-restplus.Resource 的类。
class Patient(Resource):
""" Patient endpoint."""
@clinic_api_ns.route("/patient/add/")
def post(self):
# TODO: add a patient.
return {}
@clinc_api_ns.route("/patient/<string:name>")
def get(self, name):
# TODO: get a patient record
return {}
我想从上面实现 2 个端点,但它不起作用它会引发错误:
/site-packages/flask_restplus/api.py", line 287, in _register_view resource_func = self.output(resource.as_view(endpoint, self, *resource_class_args, AttributeError: 'function' object has no attribute 'as_view'
温温酱
哆啦的时光机
相关分类