| from kong import exceptions |
| class API(kong.common.http.Client): |
| """Barebones Keystone HTTP API client.""" |
| def __init__(self, service_host, service_port): |
| super(API, self).__init__(service_host, service_port, 'v2.0') |
| #TODO(bcwaldon): This is a hack, we should clean up the superclass |
| self.management_url = self.base_url |
| def get_token(self, user, password, tenant_id): |
| headers = {'content-type': 'application/json'} |
| response, content = self.request('POST', '/tokens', |
| res_body = json.loads(content) |
| return res_body['access']['token']['id'] |