首頁  >  問答  >  主體

python - restful api server 中如何用装饰器来验证访问合法性

PHP中文网PHP中文网2741 天前327

全部回覆(1)我來回復

  • 巴扎黑

    巴扎黑2017-04-18 10:00:06

    呃。 。在你找到的資料中,不是已經有方案了嗎,何不試試看呢?

    from flask_restful import Resource
    class Foo(Resource): 
        decorators = [auth.login_required]
    
        def get(self): 
            pass 
            
        def post(self): 
            pass

    回覆
    0
  • 取消回覆