geopython / OWSLib

OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service (hence OWS) interface standards, and their related content models.
https://owslib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
381 stars 273 forks source link

wps does not parse exception report when http code is not 200 #553

Open cehbrecht opened 5 years ago

cehbrecht commented 5 years ago

A WPS service may return an exception message as XML response with HTTP code 500. OWSLib will raise a HTTP connection error but does not parse the WPS exception report:

conda/envs/birdy/lib/python3.6/site-packages/owslib/wps.py in _readFromUrl(self, url, data, method, username, password, headers, verify, cert)                                                          
    463             u = openURL(url, data, method='Post',
    464                         username=username, password=password,
--> 465                         headers=headers, verify=verify, cert=cert)
    466             return etree.fromstring(u.read())
    467

~/.conda/envs/birdy/lib/python3.6/site-packages/owslib/util.py in openURL(url_base, data, method, cookies, username, password, timeout, headers, verify, cert)                                             
    194
    195     if req.status_code in [404, 500, 502, 503, 504]:    # add more if needed
--> 196         req.raise_for_status()
    197
    198     # check for service exceptions without the http header set

~/.conda/envs/birdy/lib/python3.6/site-packages/requests/models.py in raise_for_status(self)
    938
    939         if http_error_msg:
--> 940             raise HTTPError(http_error_msg, response=self)
    941
    942     def close(self):

HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5000/wps
cehbrecht commented 5 years ago

See also: https://github.com/geopython/pywps/issues/442

benjimin commented 3 years ago

I've been getting some 502 errors from OWSLib talking to PyWPS (especially if the process fails about 30 seconds in), maybe related?