def checkuser(user, pw):
"""Check login credentials, used by auth_basic decorator."""
return bool(user in conf['users'] and conf['users'][user] == pw)
python类auth_basic()的实例源码
def test__header(self):
@bottle.route('/')
@bottle.auth_basic(lambda x, y: False)
def test(): return {}
self.assertStatus(401)
self.assertHeader('Www-Authenticate', 'Basic realm="private"')