gpt4 book ai didi

vmware - VCenter ReST API 身份验证

转载 作者:行者123 更新时间:2023-12-03 18:25:31 33 4
gpt4 key购买 nike

我正在关注 vmware 文档 https://code.vmware.com/apis/62/vcenter-management#/使用 ReST API 时要提供哪些 header 以对 VCenter Server 进行身份验证?

最佳答案

对于 python :

import requests

# https://vdc-download.vmware.com/vmwb-repository/dcr-public/1cd28284-3b72-4885-9e31-d1c6d9e26686/71ef7304-a6c9-43b3-a3cd-868b2c236c81/doc/operations/com/vmware/vcenter/vm.list-operation.html

sess = requests.post("https://XXXXXXXX/rest/com/vmware/cis/session", auth=('USERNAME', 'PASSWORD'), verify=False)
session_id = sess.json()['value']

resp = requests.get("https://XXXXXXXX/rest/vcenter/vm", verify=False, headers={
"vmware-api-session-id": session_id
})
print(u"resp.text = %s" % str(resp.text))

关于vmware - VCenter ReST API 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45026210/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com