images.py 文件源码

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

项目:kuberdock-platform 作者: cloudlinux 项目源码 文件源码
def get_token(self, chal):
        """
        Try to complete the challenge.

        :param chal: challenge string
        :returns: token or None
        """
        url = urlparse(chal.pop('realm'))
        query = urlencode(dict(parse_qsl(url.query), **chal))
        url = url._replace(query=query).geturl()
        auth = None if self.username is None \
            else (self.username, self.password)
        response = requests.get(url, auth=auth, timeout=REQUEST_TIMEOUT)
        data = _json_or_none(response)
        if isinstance(data, dict):
            return data.get('token')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号