From cad9e2246eb599f0a67692fd4ee628e8471718cc Mon Sep 17 00:00:00 2001 From: Riccardo Gori Date: Thu, 8 Feb 2018 18:05:32 +0100 Subject: [PATCH 1/2] Add keyword to set the certificate files for ssl client authentication --- influxdb/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/influxdb/client.py b/influxdb/client.py index e38d4b78..74ea3ca2 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -75,6 +75,7 @@ def __init__(self, udp_port=4444, proxies=None, pool_size=10, + ssl_cert=None ): """Construct a new InfluxDBClient object.""" self.__host = host @@ -86,6 +87,7 @@ def __init__(self, self._retries = retries self._verify_ssl = verify_ssl + self._ssl_cert = ssl_cert self.__use_udp = use_udp self.__udp_port = udp_port @@ -249,7 +251,8 @@ def request(self, url, method='GET', params=None, data=None, headers=headers, proxies=self._proxies, verify=self._verify_ssl, - timeout=self._timeout + timeout=self._timeout, + cert=self._ssl_cert ) break except (requests.exceptions.ConnectionError, From 8408a83675de6f9f80486180858013702b959039 Mon Sep 17 00:00:00 2001 From: Riccardo Gori Date: Fri, 9 Feb 2018 12:00:53 +0100 Subject: [PATCH 2/2] Add docstrings for ssl_cert --- influxdb/client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index 74ea3ca2..b3d8da83 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -45,8 +45,8 @@ class InfluxDBClient(object): False :type ssl: bool :param verify_ssl: verify SSL certificates for HTTPS requests, defaults to - False - :type verify_ssl: bool + False. If a string it must specify the path of a CA bundle to use. + :type verify_ssl: bool or str :param timeout: number of seconds Requests will wait for your client to establish a connection, defaults to None :type timeout: int @@ -59,6 +59,9 @@ class InfluxDBClient(object): :type udp_port: int :param proxies: HTTP(S) proxy to use for Requests, defaults to {} :type proxies: dict + :param ssl_cert: if string, path to ssl client cert file (.pem). If tuple, + ('cert', 'key') pair. + :type ssl_cert: str or tuple of str """ def __init__(self,