예제 #1
0
    def get(self, args, stream_epochs):
        """
        Process a *WFCatalog* GET request.
        """
        # request.method == 'GET'

        # sanity check - starttime and endtime must be specified
        if (not stream_epochs or stream_epochs[0].starttime is None or
                stream_epochs[0].endtime is None):
            raise FDSNHTTPError.create(
                400, service_version=__version__,
                error_desc_long='Both starttime and endtime required.')

        self.logger.debug('StreamEpoch objects: %r' % stream_epochs)

        # serialize objects
        s = WFCatalogSchema()
        args = s.dump(args)
        self.logger.debug('WFCatalogSchema (serialized): %s' % args)

        # process request
        processor = RequestProcessor.create(
            args['service'],
            settings.WFCATALOG_MIMETYPE,
            query_params=args,
            stream_epochs=stream_epochs,
            context=g.ctx,
            keep_tempfiles=current_app.config['FED_KEEP_TEMPFILES'],
            retry_budget_client=current_app.config['FED_CRETRY_BUDGET_ERATIO'],
            **current_app.config['FED_RESOURCE_CONFIG']['eidaws-wfcatalog'],)

        processor.post = False
        return processor.streamed_response
예제 #2
0
    def post(self, args, stream_epochs):
        """
        Process a *WFCatalog* POST request.
        """
        # request.method == 'POST'
        # NOTE: must be sent as binary to preserve line breaks
        # curl: --data-binary @postfile --header "Content-Type:text/plain"
        self.logger.debug('StreamEpoch objects: %r' % stream_epochs)

        # serialize objects
        s = WFCatalogSchema()
        args = s.dump(args)
        self.logger.debug('WFCatalogSchema (serialized): %s' % args)

        # process request
        processor = RequestProcessor.create(
            args['service'],
            settings.WFCATALOG_MIMETYPE,
            query_params=args,
            stream_epochs=stream_epochs,
            context=g.ctx,
            keep_tempfiles=current_app.config['FED_KEEP_TEMPFILES'],
            retry_budget_client=current_app.config['FED_CRETRY_BUDGET_ERATIO'],
            **current_app.config['FED_RESOURCE_CONFIG']['eidaws-wfcatalog'],)

        processor.post = True
        return processor.streamed_response
예제 #3
0
    def get(self, args, stream_epochs):
        # request.method == 'GET'
        self.logger.debug('StreamEpoch objects: %s' % stream_epochs)

        s = StationSchema()
        args = s.dump(args)
        self.logger.debug('StationSchema (serialized): %s' % args)

        # process request
        return RequestProcessor.create(args['service'],
                                       self._get_result_mimetype(args),
                                       query_params=args,
                                       stream_epochs=stream_epochs,
                                       post=False).streamed_response
예제 #4
0
    def get(self, args, stream_epochs):
        # request.method == 'GET'
        self.logger.debug('StreamEpoch objects: %s' % stream_epochs)

        # serialize objects
        s = DataselectSchema()
        args = s.dump(args)
        self.logger.debug('DataselectSchema (serialized): %s' % args)

        # process request
        return RequestProcessor.create(args['service'],
                                       settings.DATASELECT_MIMETYPE,
                                       query_params=args,
                                       stream_epochs=stream_epochs,
                                       post=False).streamed_response
예제 #5
0
    def post(self, args, stream_epochs):
        # request.method == 'POST'
        # NOTE(fab): must be sent as binary to preserve line breaks
        # curl: --data-binary @postfile --header "Content-Type:text/plain"
        self.logger.debug('StreamEpoch objects: %s' % stream_epochs)

        s = DataselectSchema()
        args = s.dump(args)
        self.logger.debug('DataselectSchema (serialized): %s' % args)

        # process request
        return RequestProcessor.create(args['service'],
                                       settings.DATASELECT_MIMETYPE,
                                       query_params=args,
                                       stream_epochs=stream_epochs,
                                       post=True).streamed_response
예제 #6
0
    def post(self, args, stream_epochs):
        """
        Process a *WFCatalog* POST request.
        """
        # request.method == 'POST'
        # NOTE: must be sent as binary to preserve line breaks
        # curl: --data-binary @postfile --header "Content-Type:text/plain"
        self.logger.debug('StreamEpoch objects: %r' % stream_epochs)

        # serialize objects
        s = WFCatalogSchema()
        args = s.dump(args)
        self.logger.debug('WFCatalogSchema (serialized): %s' % args)

        # process request
        return RequestProcessor.create(args['service'],
                                       settings.WFCATALOG_MIMETYPE,
                                       query_params=args,
                                       stream_epochs=stream_epochs,
                                       post=True).streamed_response
예제 #7
0
    def get(self, args, stream_epochs):
        # request.method == 'GET'
        self.logger.debug('StreamEpoch objects: %s' % stream_epochs)

        # serialize objects
        s = DataselectSchema()
        args = s.dump(args)
        self.logger.debug('DataselectSchema (serialized): %s' % args)

        # process request
        processor = RequestProcessor.create(
            args['service'],
            settings.DATASELECT_MIMETYPE,
            query_params=args,
            stream_epochs=stream_epochs,
            context=g.ctx,
            keep_tempfiles=current_app.config['FED_KEEP_TEMPFILES'],
            retry_budget_client=current_app.config['FED_CRETRY_BUDGET_ERATIO'],
            **current_app.config['FED_RESOURCE_CONFIG']['fdsnws-dataselect'],
        )

        processor.post = False
        return processor.streamed_response
예제 #8
0
    def get(self, args, stream_epochs):
        """
        Process a *WFCatalog* GET request.
        """
        # request.method == 'GET'

        # sanity check - starttime and endtime must be specified
        if (not stream_epochs or stream_epochs[0].starttime is None
                or stream_epochs[0].endtime is None):
            raise FDSNHTTPError.create(400, service_version=__version__)

        self.logger.debug('StreamEpoch objects: %r' % stream_epochs)

        # serialize objects
        s = WFCatalogSchema()
        args = s.dump(args)
        self.logger.debug('WFCatalogSchema (serialized): %s' % args)

        # process request
        return RequestProcessor.create(args['service'],
                                       settings.WFCATALOG_MIMETYPE,
                                       query_params=args,
                                       stream_epochs=stream_epochs,
                                       post=False).streamed_response
예제 #9
0
    def post(self, args, stream_epochs):
        # request.method == 'POST'
        self.logger.debug('StreamEpoch objects: %s' % stream_epochs)

        # serialize objects
        s = StationSchema()
        args = s.dump(args)
        self.logger.debug('StationSchema (serialized): %s' % args)

        resource_cfg = 'fdsnws-station-' + args['format']
        # process request
        processor = RequestProcessor.create(
            args['service'],
            self._get_result_mimetype(args),
            query_params=args,
            stream_epochs=stream_epochs,
            context=g.ctx,
            keep_tempfiles=current_app.config['FED_KEEP_TEMPFILES'],
            retry_budget_client=current_app.config['FED_CRETRY_BUDGET_ERATIO'],
            **current_app.config['FED_RESOURCE_CONFIG'][resource_cfg],
        )

        processor.post = True
        return processor.streamed_response