def get_object(self, *args, **kwargs): response = self._request(*args, **kwargs) if not response.json: raise exceptions.PyLXDException('Null Data') elif response.status == 200 or ( response.status == 202 and response.json.get('status_code') == 100): return response.status, response.json else: utils.get_lxd_error(response.status, response.json)
def get_object(self, *args, **kwargs): self.connection = self.get_connection() self.connection.request(*args, **kwargs) response = self.connection.getresponse() state = response.status data = json.loads(response.read()) if not data: msg = "Null Data" raise exceptions.PyLXDException(msg) elif state == 200 or (state == 202 and data.get('status_code') == 100): return state, data else: utils.get_lxd_error(state, data)