我如何让我的bottle.py应用程序(在粘贴或Cherrypy中运行)进行HTTP (基本或摘要)身份验证?-我需要保护它,但找不到任何HOWTO。
发布于 2014-05-11 20:23:44
bottle有一个内置的auth_basic装饰器,可以在视图上使用:
from bottle import auth_basic, request, route
def check(user, pw):
# Check user/pw here and return True/False
@route('/')
@auth_basic(check)
def home():
return { 'data': request.auth }发布于 2012-11-07 23:26:08
在GitHub上有一些像https://github.com/FedericoCeratto/bottle-cork这样的库应该会有帮助。它可能比相关帖子中建议的repoze库更容易集成。
https://stackoverflow.com/questions/13272528
复制相似问题