Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Add timeout constructor parameter for use in HTTPClient operations#103

Closed
mwicat wants to merge 1 commit into
python-consul:masterfrom
mwicat:master
Closed

Add timeout constructor parameter for use in HTTPClient operations#103
mwicat wants to merge 1 commit into
python-consul:masterfrom
mwicat:master

Conversation

@mwicat
Copy link
Copy Markdown

@mwicat mwicat commented May 17, 2016

Hi,

We would like to use this module in django project (for filling settings on startup), yet we cannot afford any delay on boot, so I added support for requests' timeout parameter. Would you like to merge it?

Sample usage:

start test server that will timeout when client connects:

nc -lp 8501

run code that will throw timeout after 5 seconds:

import consul
import requests

try:
   consl = consul.Consul(host='localhost', port=8501, timeout=5)
   index, values = consl.kv.get('key', recurse=True)
except requests.Timeout:
   print 'timeout occurred'

@mwicat
Copy link
Copy Markdown
Author

mwicat commented May 17, 2016

Aw, looks that this already in progress at #93 . Closing then!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant