request to vCloud via API using python returns 406?

312 views Asked by At

Based on vCloud API documentation user suppose to send the next query 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

I am trying to do the same using python, see the method down below

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

And I get 406

<Response [406]>

Please tell me why does this happen and what is a reason, because I expect to get a content

0

There are 0 answers