openstack api 获取token

1585364631
2023-02-09 / 0 评论 / 171 阅读 / 正在检测是否收录...

通过openstack api 的方式获取身份令牌token

import time, requests, json

headers = {
    "Context-Type": "json"
}

url = r'http://172.16.1.121:5000/v3/auth/tokens'

body = {
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "domain": {
                        "name": "demo"
                    },
                    "name": "admin",
                    "password": "000000"
                }
            }
        },
        "scope": {
            "project": {
                "domain": {
                    "name": "demo"
                },
                "name": "admin"
            }
        }
    }
}

token = requests.post(url=url, data=json.dumps(body), headers=headers)
print(token.headers)
0

评论 (0)

取消