![](/img/trans.png)
[英]how to hide password with ********* on swagger ui with flask_restplus in python
[英]Hide endpoints in UI of Flask restful Swagger
我正在使用flask restful swagger編寫api文檔,但是我不想在swagger提供的UI上顯示一些api端點。 代碼中有辦法嗎?
對於任何使用flask-restplus的人,您可能正在尋找一種隱藏文檔中端點的方法。
# Hide the full resource
@api.route('/resource1/', doc=False)
class Resource1(Resource):
def get(self):
return {}
@api.route('/resource2/')
@api.doc(False)
class Resource2(Resource):
def get(self):
return {}
@api.route('/resource3/')
@api.hide
class Resource3(Resource):
def get(self):
return {}
由於您沒有提供太多信息,因此根據文檔很難知道您的意思。
# Operations not decorated with @swagger.operation do not get added to the swagger docs
class Todo(Resource):
def options(self, todo_id):
"""
I'm not visible in the swagger docs
"""
pass
就是說,如果您不裝飾您的資源,它們將不會顯示在文檔中。 更多信息在這里https://github.com/rantav/flask-restful-swagger
嘗試這個
api = Api(app, doc=False)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.