【问题标题】:Flask Restplus disable API Endpoint when condition does not meet条件不满足时,Flask Restplus 禁用 API Endpoint
【发布时间】:2019-04-03 07:12:47
【问题描述】:

我可以知道如何禁用烧瓶 restplus 端点吗?

我正在尝试做一些事情,例如当条件不满足时,端点被禁用并且无法访问。

有没有办法在flask restplus 中做到这一点,或者需要自定义代码?

我知道我们可以在 swagger 文档中禁用端点。但是,这不会禁用端点,因为它仍然可以通过 curl 访问。 http://localhost:8080/api_endpoint/

【问题讨论】:

    标签: python python-3.x flask-restful flask-restplus


    【解决方案1】:

    查看 Flask 文档中的 add_url_rule

    来自 Flask 文档,http://flask.pocoo.org/docs/1.0/api/

    Internally route() invokes add_url_rule() so if you want to customize the behavior via subclassing you only need to change this method.
    
    For more information refer to URL Route Registrations.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-10
      • 2020-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-13
      • 2020-01-08
      相关资源
      最近更新 更多