katello_helpers.py 文件源码

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

项目:ballista 作者: RedHatSatellite 项目源码 文件源码
def __init__(self, base_url, username, password, verify, organization):
        """
        :param base_url: Url to connect to
        :type base_url: str
        :param username: Username for querying
        :type username: str
        :param password: Password for querying
        :type password: str
        :param verify: Whether to accept self-signed ssl
        :type verify: bool
        :param organization: Organization to use
        :type organization: str
        :returns: KatelloConnection object
        :rtype: KatelloConnection
        """
        self.organization = organization
        self.base_url = base_url
        self.session = requests.Session()
        self.session.auth = (username, password)
        self.session.verify = verify
        self.post_headers = {'Content-Type': 'application/json'}
        if not verify:
            from requests.packages.urllib3.exceptions import InsecureRequestWarning
            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

        # Check if we can authenticate
        if 'results' not in self.session.get('%s/katello/api/v2/organizations' % self.base_url).json():
            raise AuthenticationError('Authentication failed')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号