keystone.py 文件源码

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

项目:galaxia 作者: WiproOpenSourcePractice 项目源码 文件源码
def get_token():
    keystone_token_request_url = client.concatenate_url(
            CONF.gexporter.keystone_endpoint, tokens)

    headers = {
        "Content-Type": "application/json"
    }

    auth_data = {
        "auth": {
            "tenantName": CONF.gexporter.tenant_name,
            "passwordCredentials": {
                "username": CONF.gexporter.username,
                "password": CONF.gexporter.password
            }

        }
    }
    resp = client.http_request("POST", keystone_token_request_url, headers,
                               json.dumps(auth_data), None, None)
    json_resp = json.loads(resp.text)
    auth_token = json_resp["access"]["token"]["id"]
    tenant_id = json_resp["access"]["token"]["tenant"]["id"]
    return auth_token, tenant_id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号