瓶内基本认证&向用户发送文件

2024-05-29 10:16:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在瓶子框架中执行基本身份验证

def is_authenticated_user(user, password): 
    # This function is called to check if a username/password combination is valid
    return username == 'nikos' and password == ******'

称之为:

^{pr2}$

我有困难使这个工作,我不明白为什么我得到错误的方法不允许。用户的静态文件发送方式也是正确的吗?在


Tags: to框架身份验证瓶子ifisdefcheck
1条回答
网友
1楼 · 发布于 2024-05-29 10:16:55

i cannot retrieve the username given to the prompt as request.auth.username nor as request.auth.user. How can i grab that value?

According to the documentationrequest.auth(user, password)的元组。按如下方式检索用户名:

username = request.auth[0]

相关问题 更多 >

    热门问题