Skip to content

Commit e111367

Browse files
committed
fix: 118 query not using proxy (WIP)
1 parent 5739de0 commit e111367

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

influxdb_client_3/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def __init__(
166166
else:
167167
connection_string = f"grpc+tcp://{hostname}:{port}"
168168
self._query_api = _QueryApi(connection_string=connection_string, token=token,
169-
flight_client_options=flight_client_options)
169+
flight_client_options=flight_client_options,
170+
proxy=kwargs.get("proxy",None))
170171

171172
def write(self, record=None, database=None, **kwargs):
172173
"""

influxdb_client_3/query/query_api.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class QueryApi(object):
2525
def __init__(self,
2626
connection_string,
2727
token,
28-
flight_client_options) -> None:
28+
flight_client_options,
29+
proxy = None) -> None:
2930
"""
3031
Initialize defaults.
3132
@@ -35,9 +36,12 @@ def __init__(self,
3536
"""
3637
self._token = token
3738
self._flight_client_options = flight_client_options or {}
39+
self._proxy = proxy
3840
self._flight_client_options["generic_options"] = [
3941
("grpc.secondary_user_agent", USER_AGENT)
4042
]
43+
if self._proxy:
44+
self._flight_client_options["generic_options"].append(("grpc.http_proxy", self._proxy))
4145
self._flight_client = FlightClient(connection_string, **self._flight_client_options)
4246

4347
def query(self, query: str, language: str, mode: str, database: str, **kwargs):

0 commit comments

Comments
 (0)