From 90b7a19cdc4daa1230d7f15c10b113abdefdc8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tade=C3=A1=C5=A1=20Urs=C3=ADny?= Date: Wed, 9 May 2018 13:13:01 +0200 Subject: [PATCH] Set transport options on requests session Forwarded: no Last-Update: 2021-02-16 Origin: upstream, https://github.com/dims/etcd3-gateway/pull/21 Bug-Ubuntu: https://bugs.launchpad.net/+bug/1820083 --- etcd3gw/client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/etcd3gw/client.py b/etcd3gw/client.py index 6bd7e3c..623c4b2 100644 --- a/etcd3gw/client.py +++ b/etcd3gw/client.py @@ -51,12 +51,14 @@ class Etcd3Client(object): self.host = host self.port = port self.protocol = protocol + self.session = requests.Session() - self.kwargs = { - "timeout": timeout, - "verify": ca_cert, - "cert": (cert_cert, cert_key) - } + if timeout is not None: + self.session.timeout = timeout + if ca_cert is not None: + self.session.verify = ca_cert + if cert_cert is not None and cert_key is not None: + self.session.cert = (cert_cert, cert_key) def get_url(self, path): """Construct a full url to the v3alpha API given a specific path -- 2.25.1