def load(self, store: frozendict): if self.status is None: self.status = store.get(self.status_field, 200) return make_response(store.get(self.data_field), status=self.status, headers=self.headers)
def run_pipe(self) -> frozendict: """The main method. Takes data and pass through pipe. Handles request and response :raises: PipeException """ pipe_to_run = self.pipe_schema.get(self.request.method, None) if pipe_to_run is None: return make_response('method isn\'t supported', status=400) self._run_pipe(pipe_to_run.get('in', ())) return self._run_pipe(pipe_to_run.get('out', ()))
def load(self, store: frozendict): return make_response(f'bad request: {store.get("exception")}', status=400)
def load(self, store: frozendict): return make_response(f'unauthorized: {store.get("exception")}', status=401)
def load(self, store: frozendict): return make_response(f'server error: {store.get("exception")}', status=500)
def load(self, store: frozendict): return make_response(f'object not found: {store.get("exception")}', status=404)
def load(self, store: frozendict): return make_response(store.get(self.data_field), is_json=True, status=self.status)