Python-zeep: Transport timeout option not functioning properly

Created on 20 Jul 2016  路  5Comments  路  Source: mvantellingen/python-zeep

I've tried setting the timeout option in the Transport constructor to timeout=10 and simulated a timeout by disabling my wifi. I found that it took about 3 minutes for the request to return a ReadTimeout error. Trying a second time, the error came back after 1 minute, which is not only the 10 seconds I specified, but also inconsistent with the 3 minutes from before.

My code is as below:

transport = Transport(http_auth=(username, apiKey), timeout=10)
connection = Client(wsdl=myURL, transport=transport)

If I'm doing something wrong, any tips would be greatly appreciated. Thanks!

componentransport enhancement

Most helpful comment

This can now be done via::

transport = Transport(operation_timeout=360)
client = Client(url, transport=transport)

Or

client = Client(url)
with client.options(timeout=360):
    clients.service.slow_call()

All 5 comments

Seems that the timeout for now is only used for loading wsdl/xsd files. Not for XML POST/GET requests. That should probably be added (and perhaps as another kwarg).

Speaking of POST/GET requests, is there a way to access the properties of the HTTP responses from the requests? I'm currently trying to figure out how to get the response's status code.

You can achieve this by subclassing the tranport class and keeping a reference to the last response object there. It's discussed a bit in #91.

+1 to this, XML POST/GET should use the timeout given. Less importantly, being allowed to specify timeouts on a per-binding or per-request basis might be good.

This can now be done via::

transport = Transport(operation_timeout=360)
client = Client(url, transport=transport)

Or

client = Client(url)
with client.options(timeout=360):
    clients.service.slow_call()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhinchakdhoom picture dhinchakdhoom  路  4Comments

alexdemari picture alexdemari  路  4Comments

pope1ni picture pope1ni  路  4Comments

alexfx picture alexfx  路  4Comments

grguthrie picture grguthrie  路  4Comments