通过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)