HTTPBasicAuth基本原理
from flask_httpauth import HTTPBasicAuth
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(account,password):
return True
发请求时要在header中加入 key:Authorzation value:basic basic64加密过后的(账号:密码)
例:
key:Authorzation value:basic d2FuZ3E6MTIzNDU2加密前(wangq:123456)
view目录加验证时,函数上加
@auth.login_required