def get_token(self): if self.auth_token: return self.auth_token headers = {'content-type': 'application/json'} request_body = utils.dumps({"passwordCredentials": {"username": self.username, 'password': self.access_key}}) res, body = self.request(self.url, "POST", headers=headers, body=request_body) if int(res.status) >= 400: raise Exception(_("Error occured while retrieving token : %s") % body) return utils.loads(body)['auth']['token']['id']
def update(self, id, **kwargs): return self.request("PUT", self._member_path(id), body=utils.dumps( {self.name: utils.remove_nones(kwargs)}))
def create(self, **kwargs): return self.request("POST", self.path, body=utils.dumps({self.name: kwargs}))