14
14
def write_options (** kwargs ):
15
15
return _WriteOptions (** kwargs )
16
16
17
+ def flight_client_options (** kwargs ):
18
+ return kwargs # You can replace this with a specific data structure if needed
19
+
20
+
21
+
17
22
18
23
19
24
20
25
class InfluxDBClient3 :
21
- def __init__ (self , host = None , org = None , database = None , token = None , write_options = None , ** kwargs ):
26
+ def __init__ (self , host = None , org = None , database = None , token = None , write_options = None , flight_client_options = None , ** kwargs ):
22
27
"""
23
28
This class provides an interface for interacting with an InfluxDB server, simplifying common operations such as writing, querying.
24
29
* host (str, optional): The hostname or IP address of the InfluxDB server. Defaults to None.
@@ -33,7 +38,9 @@ def __init__(self, host=None, org=None, database=None, token=None, write_options
33
38
self .write_options = write_options if write_options is not None else SYNCHRONOUS
34
39
self ._client = _InfluxDBClient (url = f"https://{ host } " , token = token , org = self ._org , ** kwargs )
35
40
self ._write_api = _WriteApi (self ._client , write_options = self .write_options )
36
- self ._flight_client = FlightClient (f"grpc+tls://{ host } :443" )
41
+
42
+ self ._flight_client_options = flight_client_options if flight_client_options is not None else {}
43
+ self ._flight_client = FlightClient (f"grpc+tls://{ host } :443" , ** self ._flight_client_options )
37
44
# create an authorization header
38
45
self ._options = FlightCallOptions (headers = [(b"authorization" ,f"Bearer { token } " .encode ('utf-8' ))])
39
46
@@ -109,4 +116,4 @@ def __enter__(self):
109
116
def __exit__ (self , exc_type , exc_val , exc_tb ):
110
117
self .close ()
111
118
112
- __all__ = ["InfluxDBClient3" , "Point" , "PointSettings" , "SYNCHRONOUS" , "ASYNCHRONOUS" , "write_options" , "WritePrecision" ]
119
+ __all__ = ["InfluxDBClient3" , "Point" , "PointSettings" , "SYNCHRONOUS" , "ASYNCHRONOUS" , "write_options" , "WritePrecision" , "flight_client_options" ]
0 commit comments