I'm using owslib.wps inside a QGIS plugin to retrieve a pywps query output. Here is a piece of code that I run from the QGIS console:
import owslib.wps
from owslib.wps import WebProcessingService, printInputOutput, monitorExecution
processid = 'tp_np1'
wps = WebProcessingService('http://myhost/wps', verbose=False)
inputs = [("input1", "table01"),
("input2","91")]
execution = wps.execute(processid, inputs)
out = execution.processOutputs[0].data[0]
table_name = out.rsplit('/', 1)[1]
vlayer = QgsVectorLayer(out, table_name, "ogr")
if not vlayer.isValid():
print ("Layer failed to load!")
QgsProject.instance().addMapLayer(vlayer)
iface.showAttributeTable(vlayer)
When I run a long query, I get this error:
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 1331, in getresponse
response.begin()
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\OSGEO4~1\apps\Python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\adapters.py", line 423, in send
timeout=timeout
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\util\retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\packages\six.py", line 686, in reraise
raise value
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 388, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 308, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='myhost', port=8080): Read timed out. (read timeout=30)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "<string>", line 9, in <module>
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 275, in execute
response = execution.submitRequest(request)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 732, in submitRequest
self.url, request, method='Post', username=self.username, password=self.password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 475, in readFromUrl
return self._readFromUrl(url, data, method, username=username, password=password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 396, in _readFromUrl
username=username, password=password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\util.py", line 183, in openURL
**rkwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\adapters.py", line 499, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout:
HTTPConnectionPool(host='myhost', port=8080): Read timed out. (read timeout=30)
Is there a way to set a different timeout value ?
Note : I'm using QGIS Dev 2.99 with python 3.6, but also I'm getting the same error message with QGIS 2.18 and python 2.7