Jam*_*net 13 python authentication http digest bottle
如何让我的bottle.py应用程序(在Paste或Cherrypy中运行)进行HTTP(基本或摘要)身份验证? - 我需要保护它,但无法找到任何HOWTO.
M S*_*lle 22
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 }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9739 次 |
| 最近记录: |