[PyWPS-dev] Testing the services via Python

Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PyWPS-dev] Testing the services via Python

nagyrobi_r
Hei wonderful people.

I am new to PyWPS, which i see as a wonderful tool and i am trying to learn. I am trying to test if the dev server works without having any kind of front-end developed. I am making a mistake here, wouldn't know what. Could anybody please guide me on how i could test the processes with python?

import requests

headers = {'Content-Type':'application/gml+xml'}
target_url = 'http://localhost:5000/wps?service=wps&version=1.0.0&request=execute&identifier=feature_count'

with open('/home/robocop/pywps/pywps/pywps/data/railroads.gml', 'rb') as f:
    files = {'layer': f}
    r = requests.post(target_url,
                      headers=headers,
                      files=files)

This lands me a 400 error, with exceptionCode = "NoApplicableCode"

Thank you for your time.


Kind regards,
Robert Nagy

_______________________________________________
pywps-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pywps-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing the services via Python

Carsten Ehbrecht-3
Hi Robert,

There is the Emu WPS with some example processes … and also tests:
https://github.com/bird-house/emu/blob/master/tests/test_wps_pandas.py

You can also use OWSLib or birdy to execute the process more conveniently:
https://nbviewer.jupyter.org/github/bird-house/birdy/blob/v0.7.0/notebooks/examples/emu-example.ipynb

In your example it looks like you are using POST method for a WPS GET request.

A doc (a bit dusty) I use to lookup the WPS details:
http://geoprocessing.info/wpsdoc/1x0Execute

Some other outdated examples:
https://github.com/bird-house/notebooks/blob/master/sandbox/tutorial/t04-wps-execute.ipynb

Cheers,
Carsten
--
Carsten Ehbrecht
Abteilung Datenmanagement

Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstraße 45 a • D-20146 Hamburg • Germany

Phone: +49 40 460094-148
FAX:   +49 40 460094-270
Email: [hidden email]
URL:   www.dkrz.de

Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784

> On 12. Mar 2021, at 19:36, [hidden email] wrote:
>
> Hei wonderful people.
>
> I am new to PyWPS, which i see as a wonderful tool and i am trying to learn. I am trying to test if the dev server works without having any kind of front-end developed. I am making a mistake here, wouldn't know what. Could anybody please guide me on how i could test the processes with python?
>
> import requests
>
> headers = {'Content-Type':'application/gml+xml'}
> target_url = 'http://localhost:5000/wps?service=wps&version=1.0.0&request=execute&identifier=feature_count'
>
> with open('/home/robocop/pywps/pywps/pywps/data/railroads.gml', 'rb') as f:
>     files = {'layer': f}
>     r = requests.post(target_url,
>                       headers=headers,
>                       files=files)
>
> This lands me a 400 error, with exceptionCode = "NoApplicableCode"
>
> Thank you for your time.
>
>
> Kind regards,
> Robert Nagy
> _______________________________________________
> pywps-dev mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/pywps-dev

_______________________________________________
pywps-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pywps-dev

signature.asc (849 bytes) Download Attachment