request.py 文件源码

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

项目:packaging 作者: blockstack 项目源码 文件源码
def retry_http_basic_auth(self, host, req, realm):
        user, pw = self.passwd.find_user_password(realm, host)
        if pw is not None:
            raw = "%s:%s" % (user, pw)
            auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii")
            if req.headers.get(self.auth_header, None) == auth:
                return None
            req.add_unredirected_header(self.auth_header, auth)
            return self.parent.open(req, timeout=req.timeout)
        else:
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号