keystone REST API and python [closed]
I am running Havana, and I have verified the install of install of the identity service by using running the following:
keystone --os-username=uname --os-password=pword --os-auth-url=http://localhost:35357/v2.0 token-get
which returns the token just fine. When I run the following python script on another machine on my network I get an HTTP 401 when using port 9696 and HTTP 400 when using port 35357.
import requests
username = 'uname'
password = 'pword'
payload = {'auth': {'tenantName': 'tenant1', 'passwordCredentials': {'username': uname, 'password': pword}}}
print requests.post('http://10.20.30.40:9696/v2.0/tokens', data=payload)
What am I missing? The guide I am using is http://docs.openstack.org/api/openstack-identity-service/2.0/content/Request_Response_Types-d1e149.html (here).
EDIT: I have also tried using curl and the following command: url -d '{"auth":{“tenantName": “tenant1", "passwordCredentials": {"username": “uanme", "password": “pword"}}}' -H "Content-type: application/json" http://10.20.30.40:35357/v2.0/tokens
but that returns the following: {"error": {"message": "Expecting to find valid JSON in request body. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.", "code": 400, "title": "Bad Request"}}
I got that curl command from http://docs.openstack.org/developer/keystone/api_curl_examples.html (http://docs.openstack.org/developer/k...) .