session.py 文件源码

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

项目:python-cratonclient 作者: openstack 项目源码 文件源码
def __init__(self, session=None, username=None, token=None,
                 project_id=None):
        """Initialize our Session.

        :param session:
            The session instance to use as an underlying HTTP transport. If
            not provided, we will create a keystoneauth1 Session object.
        :param str username:
            The username of the person authenticating against the API.
        :param str token:
            The authentication token of the user authenticating.
        :param str project_id:
            The user's project id in Craton.
        """
        if session is None:
            _auth = auth.CratonAuth(
                username=username,
                project_id=project_id,
                token=token,
            )
            session = ksa_session.Session(auth=_auth)
        self._session = session
        self._session.user_agent = 'python-cratonclient/{0}'.format(
            cratonclient.__version__)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号