async def fetch_batch(self, request): """Fetches a specific batch from the validator, specified by id. Request: path: - batch_id: The 128-character id of the block to be fetched Response: data: A JSON object with the data from the fully expanded Batch link: The link to this exact query """ error_traps = [ error_handlers.MissingBatch(), error_handlers.InvalidBatchId() ] batch_id = request.match_info.get('batch_id', '') response = await self._query_validator( Message.CLIENT_BATCH_GET_REQUEST, client_pb2.ClientBatchGetResponse, client_pb2.ClientBatchGetRequest(batch_id=batch_id), error_traps) return self._wrap_response(data=self._expand_batch(response['batch']), metadata=self._get_metadata( request, response))
def batch_get(self, request): """ Fetch a particular batch from the validator """ error_traps = [ error_handlers.MissingBatch(), error_handlers.InvalidBatchId() ] batch_id = request.match_info.get('batch_id', '') response = self._query_validator( Message.CLIENT_BATCH_GET_REQUEST, client.ClientBatchGetResponse, client.ClientBatchGetRequest(batch_id=batch_id), error_traps) return RouteHandler._wrap_response( data=RouteHandler._expand_batch(response['batch']), metadata=RouteHandler._get_metadata(request, response))