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

Add keyword to set the certificate files for ssl client authentication #562

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -75,6 +78,7 @@ def __init__(self,
udp_port=4444,
proxies=None,
pool_size=10,
ssl_cert=None
):
"""Construct a new InfluxDBClient object."""
self.__host = host
Expand All @@ -86,6 +90,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
Expand Down Expand Up @@ -249,7 +254,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,
Expand Down