我有以下繼承自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 {} 我想從上面實(shí)現(xiàn) 2 個(gè)端點(diǎn),但它不起作用它會(huì)引發(fā)錯(cuò)誤:/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'
如何從同一個(gè)flask-restplus Resource類獲取和發(fā)布端點(diǎn)?
開(kāi)心每一天1111
2021-09-24 21:28:44