cli.py 文件源码

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

项目:rq-scheduler-dashboard 作者: lamflam 项目源码 文件源码
def add_basic_auth(blueprint, username, password, realm='RQ Scheduler Dashboard'):
    """Add HTTP Basic Auth to a blueprint.

    Note this is only for casual use!

    """
    @blueprint.before_request
    def basic_http_auth(*args, **kwargs):
        auth = request.authorization
        if (
                auth is None
                or auth.password != password
                or auth.username != username):
            return Response(
                'Please login',
                401,
                {'WWW-Authenticate': 'Basic realm="{}"'.format(realm)})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号