【发布时间】:2011-10-24 14:32:07
【问题描述】:
在烧瓶中,我使用以下snippet 来启用 HTTP 身份验证:
def authenticate():
return Response('<Why access is denied string goes here...>', 401, {'WWW-Authenticate':'Basic realm="Login Required"'})
现在,根据我过去使用 Flask 的经验,如果有人的凭据不正确,我想让他们知道我可以打电话:
abort(401)
这为您提供了基本的 apache 401 响应。有谁知道我如何使用上面的 sn-p 来实现它?
谢谢
【问题讨论】:
-
如果您有不同的401原因,
abort(401, '<Why access is denied string goes here...>')也可以。
标签: python apache2 flask http-authentication abort