Moved modification of URL to get_token method.

This commit is contained in:
gary-hessler 2014-06-26 15:20:56 -06:00
parent 974bd5a289
commit b2125705f2
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class Keystone(object):
return cls._instance
def __init__(self, endpoint, user_id, password, project_name):
self.endpoint = endpoint.rstrip('/') + '/auth/tokens'
self.endpoint = endpoint
self.user_id = user_id
self.password = password
self.project_name = project_name
@ -57,7 +57,7 @@ class Keystone(object):
self.password_auth['auth']['scope']['project']['name'] = self.project_name
data = json.dumps(self.password_auth)
headers = {'Content-Type': 'application/json'}
response = requests.post(self.endpoint, data=data, headers=headers)
response = requests.post(self.endpoint.rstrip('/') + '/auth/tokens', data=data, headers=headers)
response.raise_for_status()
self.token = response.headers['X-Subject-Token']
return self.token