8
8
9
9
10
10
class QueryApiOptions (object ):
11
- tls_root_certs = None
12
- tls_verify = None
13
- proxy = None
14
- flight_client_options = None
11
+ """
12
+ Structure for encapsulating options for the QueryApi
13
+
14
+ Attributes
15
+ ----------
16
+ tls_root_certs (bytes): contents of an SSL root certificate or chain read as bytes
17
+ tls_verify (bool): whether to verify SSL certificates or not
18
+ proxy (str): URL to a proxy server
19
+ flight_client_options (dict): base set of flight client options passed to internal pyarrow.flight.FlightClient
20
+ """
21
+ tls_root_certs : bytes = None
22
+ tls_verify : bool = None
23
+ proxy : str = None
24
+ flight_client_options : dict = None
15
25
16
26
def __init__ (self , root_certs_path , verify , proxy , flight_client_options ):
27
+ """
28
+ Initialize a set of QueryApiOptions
29
+
30
+ :param root_certs_path: path to a certificate .pem file.
31
+ :param verify: whether to verify SSL certificates or not.
32
+ :param proxy: URL of a proxy server, if required.
33
+ :param flight_client_options: set of flight_client_options
34
+ to be passed to internal pyarrow.flight.FlightClient.
35
+ """
17
36
if root_certs_path :
18
37
self .tls_root_certs = self ._read_certs (root_certs_path )
19
38
self .tls_verify = verify
@@ -26,7 +45,21 @@ def _read_certs(self, path):
26
45
27
46
28
47
class QueryApiOptionsBuilder (object ):
48
+ """
49
+ Helper class to make adding QueryApiOptions more dynamic.
29
50
51
+ Example:
52
+
53
+ .. code-block:: python
54
+
55
+ options = QueryApiOptionsBuilder()\
56
+ .proxy("http://internal.tunnel.proxy:8080") \
57
+ .root_certs("/home/fred/.etc/ssl/alt_certs.pem") \
58
+ .tls_verify(True) \
59
+ .build()
60
+
61
+ client = QueryApi(connection, token, None, None, options)
62
+ """
30
63
_root_certs_path = None
31
64
_tls_verify = True
32
65
_proxy = None
@@ -49,6 +82,7 @@ def flight_client_options(self, flight_client_options):
49
82
return self
50
83
51
84
def build (self ):
85
+ """Build a QueryApiOptions object with previously set values"""
52
86
return QueryApiOptions (
53
87
root_certs_path = self ._root_certs_path ,
54
88
verify = self ._tls_verify ,
@@ -62,6 +96,7 @@ class QueryApi(object):
62
96
Implementation for '/api/v2/query' endpoint.
63
97
64
98
Example:
99
+
65
100
.. code-block:: python
66
101
67
102
from influxdb_client import InfluxDBClient
0 commit comments