csrf.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:Sci-Finder 作者: snverse 项目源码 文件源码
def exempt(self, view):
        """Mark a view or blueprint to be excluded from CSRF protection.

        ::

            @app.route('/some-view', methods=['POST'])
            @csrf.exempt
            def some_view():
                ...

        ::

            bp = Blueprint(...)
            csrf.exempt(bp)

        """

        if isinstance(view, Blueprint):
            self._exempt_blueprints.add(view.name)
            return view

        if isinstance(view, string_types):
            view_location = view
        else:
            view_location = '%s.%s' % (view.__module__, view.__name__)

        self._exempt_views.add(view_location)
        return view
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号