__init__.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:lagendacommun 作者: ecreall 项目源码 文件源码
def _get_basicauth_credentials(request):
    authorization = AUTHORIZATION(request.environ)
    try:
        authmeth, auth = authorization.split(' ', 1)
    except ValueError:  # not enough values to unpack
        return None
    if authmeth.lower() == 'basic':
        try:
            auth = base64.b64decode(auth.strip().encode('ascii'))
        except binascii.Error:  # can't decode
            return None
        try:
            login, password = auth.decode('utf8').split(':', 1)
        except ValueError:  # not enough values to unpack
            return None
        return {'login': login, 'password': password}

    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号