How to use the pywps.Service function in pywps

To help you get started, we’ve selected a few pywps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geopython / pywps / tests / test_execute.py View on Github external
def test_missing_process_error(self):
        client = client_for(Service(processes=[create_ultimate_question()]))
        resp = client.get('?Request=Execute&identifier=foo')
        assert resp.status_code == 400
github geopython / pywps / tests / test_describe.py View on Github external
def describe_process(self, process):
        client = client_for(Service(processes=[process]))
        resp = client.get('?service=wps&version=1.0.0&Request=DescribeProcess&identifier=%s'
                          % process.identifier)
        [result] = get_describe_result(resp)
        return result
github geopython / pywps / tests / test_execute.py View on Github external
def test_dods(self):
        if not WITH_NC4:
            self.skipTest('netCDF4 not installed')
        my_process = create_complex_nc_process()
        service = Service(processes=[my_process])

        href = "http://test.opendap.org:80/opendap/netcdf/examples/sresa1b_ncar_ccsm3_0_run1_200001.nc"

        """ # Is this how the request should be written ?
        request_doc = WPS.Execute(
            OWS.Identifier('my_opendap_process'),
            WPS.DataInputs(
                WPS.Input(
                    OWS.Identifier('dods'),
                    WPS.Reference(
                        WPS.Body('request body'),
                        {'{http://www.w3.org/1999/xlink}href': href},
                        method='POST'
                    )
                    #WPS.Data(WPS.ComplexData(href=href, mime_type='application/x-ogc-dods'))
                    # This form is not supported yet. Should it be ?
github bird-house / flyingpigeon / tests / test_wps_spatial_analog.py View on Github external
def test_wps_spatial_analog_process():
    client = client_for(Service(processes=[SpatialAnalogProcess()]))
    datainputs = "candidate=files@xlink:href={c};" \
                 "target=files@xlink:href={t};" \
                 "location={lon},{lat};" \
                 "indices={i1};indices={i2};" \
                 "dist={dist};" \
                 "dateStartCandidate={start};" \
                 "dateEndCandidate={end};" \
                 "dateStartTarget={start};" \
                 "dateEndTarget={end}"\
        .format(t=TESTDATA['indicators_small_nc'],
                c=TESTDATA['indicators_medium_nc'],
                lon=-72,
                lat=46,
                i1='meantemp',
                i2='totalpr',
                dist='seuclidean',
github bird-house / flyingpigeon / tests / test_wps_spatial_analog.py View on Github external
def test_wps_plot_spatial_analog():
    client = client_for(
        Service(processes=[PlotSpatialAnalogProcess()], cfgfiles=CFG_FILE))
    datainputs = (
        "resource=files@xlink:href={0};"
        "fmt={1};fmt={2};fmt={3};fmt={4};"
        "title={5}"
    ).format(TESTDATA['dissimilarity_nc'], 'png', 'pdf', 'svg', 'eps', "Spatial Analog Example")

    resp = client.get(
        service='wps', request='execute', version='1.0.0',
        identifier='plot_spatial_analog',
        datainputs=datainputs)

    assert_response_success(resp)
github bird-house / flyingpigeon / tests / test_wps_pointinspection.py View on Github external
def test_wps_pointinspection():
    client = client_for(
        Service(processes=[PointinspectionProcess()]))  # ,cfgfiles=CFG_FILE
    datainputs = datainputs_fmt.format(
        TESTDATA['cmip5_tasmax_2006_nc'],
        "2.356138, 48.846450",)
    resp = client.get(
        service='wps', request='execute', version='1.0.0',
        identifier='pointinspection',
        datainputs=datainputs)
    assert_response_success(resp)
github bird-house / flyingpigeon / tests / test_wps_subset_bbox.py View on Github external
def test_wps_subset_bbox():
    client = client_for(Service(processes=[SubsetBboxProcess()], cfgfiles=CFG_FILE))

    datainputs = "resource=files@xlink:href={fn};" \
                 "lat0={lat0};" \
                 "lon0={lon0};" \
                 "lat1={lat1};" \
                 "lon1={lon1};" \
                 .format(fn=TESTDATA['cmip5_tasmax_2006_nc'], lat0=2., lon0=3., lat1=4., lon1=5.)

    resp = client.get(
        "?service=WPS&request=Execute&version=1.0.0&identifier=subset_bbox&datainputs={}".format(
            datainputs))

    print(resp.get_data())
    assert_response_success(resp)

    out = get_output(resp.xml)
github geopython / pywps / tests / test_ows.py View on Github external
def test_wcs(self):
        try:
            sys.path.append("/usr/lib/grass64/etc/python/")
            import grass.script as grass
        except Exception:
            self.skipTest('GRASS lib not found')
        client = client_for(Service(processes=[create_sum_one()]))
        request_doc = WPS.Execute(
            OWS.Identifier('sum_one'),
            WPS.DataInputs(
                WPS.Input(
                    OWS.Identifier('input'),
                    WPS.Reference(href=wcsResource, mimeType='image/tiff'))),
            WPS.ProcessOutputs(
                WPS.Output(
                    OWS.Identifier('output'))),
            version='1.0.0')
        resp = client.post_xml(doc=request_doc)
        assert_response_success(resp)
        # Other things to assert:
github geopython / pywps-flask / server.py View on Github external
self.output_path = configuration.get_config_value('server', 'outputpath')
        self.temp_path = configuration.get_config_value('server', 'workdir')

        # check if in the configuration file specified directory exists otherwise create it
        try:
            if not os.path.exists(self.temp_path):
                os.makedirs(self.temp_path)
                print('%s does not exist. Creating it.' % self.temp_path)
            if not os.path.exists(self.output_path):
                os.makedirs(self.output_path)
                print('%s does not exist. Creating it.' % self.output_path)
        except Exception as e:
            raise NoApplicableCode('File error: Could not create folder. %s' % e)

        self.processes = processes
        self.service = Service(processes=self.processes)
github gabrielbazan / lycheepy / lycheepy / worker / worker / distribution / worker.py View on Github external
processes = ProcessesGateway(
        PROCESSES_GATEWAY_HOST,
        PROCESSES_GATEWAY_USER,
        PROCESSES_GATEWAY_PASS,
        PROCESSES_GATEWAY_TIMEOUT,
        PROCESSES_GATEWAY_DIRECTORY
    )

    request = WPSRequest()
    request.json = wps_request_json
    request.status = 'false'

    logging.info('WPS request: {}'.format(dumps(wps_request_json)))

    with processes.get_process_context(identifier, LOCAL_PROCESSES_REPOSITORY) as process_context:
        service = Service([process_context.get_process_instance()], CONFIGURATION_FILE)
        response = service.processes.get(identifier).execute(request, uuid1())
        outputs = OutputsSerializer.to_json(response.outputs)

    logging.info('Process outputs: {}'.format(dumps(outputs)))

    return dict(process=identifier, outputs=outputs)