基于 vCloud API 文档,用户假设发送下一个查询
POST https://vcloud.example.com/api/sessions
Authorization: Basic encoded-credentials
Accept: application/*+xml;version=5.5
Response:
200 OK
x-vcloud-authorization: cn9uYmdugN8E2j96+5Lqrc3YBvFsEgDHXzyfJrJ/6bM=
Content-Type: application/vnd.vmware.vcloud.session+xml;version=5.5
我正在尝试使用 python 做同样的事情,请参阅下面的方法
def vcloud_send():
vcloud = requests.Session()
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
result = base64.b64encode(b'user@org:password')
headers = {'Authorization': b"encoded login:password",
'Accept': 'application/*+xml'}
response = vcloud.request('POST', url='https://host/api/session', headers=headers, verify=False)
return response
我得到 406
<Response [406]>
请告诉我为什么会发生这种情况以及原因是什么,因为我希望获得内容