[PyWPS-dev] Testing the services via Python

Carsten Ehbrecht ehbrecht at dkrz.de
Wed Apr 7 10:53:47 PDT 2021


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: ehbrecht at dkrz.de
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, nagyrobi_r at yahoo.com 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
> pywps-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pywps-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.osgeo.org/pipermail/pywps-dev/attachments/20210407/79687603/attachment.sig>


More information about the pywps-dev mailing list