Skip to content

Commit 3090db1

Browse files
refactor: wip
1 parent 9556a0c commit 3090db1

2 files changed

Lines changed: 622 additions & 36 deletions

File tree

influxdb_client_3/__init__.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def __init__(
189189
org=None,
190190
database=None,
191191
token=None,
192+
auth_scheme=None,
193+
enable_gzip=False,
194+
gzip_threshold=None,
192195
write_client_options=None,
193196
flight_client_options=None,
194197
write_port_overwrite=None,
@@ -229,6 +232,8 @@ def __init__(
229232
:key urllib3.util.retry.Retry retries: Set the default retry strategy that is used for all HTTP requests
230233
except batching writes. As a default there is no one retry strategy.
231234
:key str query_timeout: int value used to set the client query API timeout in milliseconds.
235+
:key str enable_gzip: TODO ???
236+
:key str gzip_threshold: TODO ???
232237
:key str write_timeout: int value used to set the client write API timeout in milliseconds.
233238
:key bool write_accept_partial: allow partial writes when some lines fail.
234239
:key bool write_use_v2_api: route writes through /api/v2/write compatibility endpoint.
@@ -293,14 +298,19 @@ def __init__(
293298
if write_port_overwrite is not None:
294299
port = write_port_overwrite
295300

296-
self._client = _InfluxDBClient(
297-
url=f"{scheme}://{hostname}:{port}",
301+
# TODO point_settings??
302+
# TODO enable_gzip and gzip_threshold be in WriteOptions
303+
self._write_api = _WriteApi(
304+
base_url=f"{scheme}://{hostname}:{port}",
298305
token=self._token,
306+
bucket=self._database,
299307
org=self._org,
308+
gzip_threshold=gzip_threshold,
309+
enable_gzip=enable_gzip,
310+
auth_scheme=auth_scheme,
300311
timeout=write_timeout,
301-
**kwargs)
302-
303-
self._write_api = _WriteApi(influxdb_client=self._client, **self._write_client_options)
312+
**self._write_client_options
313+
)
304314

305315
if query_port_overwrite is not None:
306316
port = query_port_overwrite
@@ -702,7 +712,6 @@ def close(self):
702712
"""Close the client and clean up resources."""
703713
self._write_api.close()
704714
self._query_api.close()
705-
self._client.close()
706715

707716
def __enter__(self):
708717
return self

0 commit comments

Comments
 (0)