Python 瓶内基本认证&;向用户发送文件';s浏览器

Python 瓶内基本认证&;向用户发送文件';s浏览器,python,bottle,Python,Bottle,我正在尝试在瓶子框架中执行基本身份验证 def is_authenticated_user(user, password): # This function is called to check if a username/password combination is valid return username == 'nikos' and password == ******' 并称之为: @app.route( '/file', methods=['POST'] ) @

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

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

@app.route( '/file', methods=['POST'] )
@auth_basic( is_authenticated_user ) 
.... 
.... 
filename = request.form.get('filename') return static_file( filename, root='/home/nikos/wsgi/static/files' )
我很难做到这一点,我不明白为什么我得到的错误方法是不允许的。静态文件功能是否也是将文件发送到用户浏览器的正确方式

我无法检索作为request.auth.username或作为request.auth.user提供给提示符的用户名。我怎样才能得到那个值

request.auth
(用户、密码)
的元组。按如下方式检索用户名:

username = request.auth[0]

你的请求头是什么?我如何检查它们是什么?!执行
打印(请求标题)
中的
是经过身份验证的用户
并显示输出。事实上,我能够使基本的_身份验证正常工作。
如果你想帮助我解决这个让我发疯的问题,哦,而且我无法检索作为
请求.身份验证.用户名
或作为
请求.身份验证.用户
提供给提示符的用户名。我怎样才能得到那个值?