diff --git a/pykube/http.py b/pykube/http.py index 8cdfdb6..40ebfcc 100644 --- a/pykube/http.py +++ b/pykube/http.py @@ -150,7 +150,7 @@ class HTTPClient(object): _session = None - def __init__(self, config): + def __init__(self, config, timeout=10): """ Creates a new instance of the HTTPClient. @@ -160,6 +160,8 @@ def __init__(self, config): self.config = config self.url = self.config.cluster["server"] + self.timeout = timeout + session = requests.Session() session.mount("https://", KubernetesHTTPAdapter(self.config)) session.mount("http://", KubernetesHTTPAdapter(self.config)) @@ -227,6 +229,7 @@ def get_kwargs(self, **kwargs): url = url[1:] bits.append(url) kwargs["url"] = self.url + posixpath.join(*bits) + kwargs["timeout"] = self.timeout return kwargs def raise_for_status(self, resp):