我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用bottle.auth_basic()。
def checkuser(user, pw): """Check login credentials, used by auth_basic decorator.""" return bool(user in conf['users'] and conf['users'][user] == pw)
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"')