add a way to specify the timeout on http requests
I'd like to be able to set a timeout on the requests made by requests.
http://docs.python-requests.org/en/latest/user/quickstart/#timeouts
I could work on a pull request if one of the following options looks acceptable.
- option 1 add a timeout parameter to the Consul constructor
consul = Consul(timeout=12)
and/or
- option 2 add a time parameter functions that call requests.*
consul = Consul()
consul.acl.create(rules=rules, timeout=timeout)
timeout would be optional in both cases.
If we add a timeout, using both option 1 + 2 would be the way to go.
All the http clients should be updated to taken an optional timeout.
Is it possible to describe when you need this? When talking to consul on localhost, if it's unavailable, the http request should return immediately with a 500...
Hi we use consul's while processing incoming calls in a pbx. This process is synchronous and we cannot block a call more than a few seconds which is easier to do with a timeout. It's also possible to have consul running on another server in our architecture.
:+1: for this. When testing consul fail scenarios and dropping all traffic from other nodes, simple curl localhost:8500/v1/session/list hangs for couple of minutes, leaving all processes communicating with consul in limbo state.
Need this feature too. Our consul agent is running on another server, so it's much easier to suffer from network issues. The default timeout of requests is simply None, which makes the request really uncontrollable.