Skip to content

Commit 4c9d130

Browse files
refactor: write rest client
1 parent a15c806 commit 4c9d130

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

influxdb_client_3/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,10 @@ def __init__(
309309

310310
auth_schema = 'Token' if auth_scheme is None else auth_scheme
311311
default_header = {
312-
'Authorization': f'{auth_schema} {self._token}',
313312
'User-Agent': USER_AGENT
314313
}
314+
if self._token is not None:
315+
default_header['Authorization'] = f'{auth_schema} {self._token}'
315316
self.base_url = f"{scheme}://{hostname}:{port}"
316317
self.default_header = default_header
317318
self.rest_client = rest.RestClient(

influxdb_client_3/write_client/client/write_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,10 @@ def _post_write(self, _async_req, bucket, org, body, precision, no_sync, accept_
768768
query_params,
769769
header_params,
770770
body=body_params,
771-
async_req=local_var_params.get('async_req'),
771+
async_req=_async_req,
772772
_request_timeout=local_var_params.get('_request_timeout'),
773773
urlopen_kw=http_kwargs.get('urlopen_kw', None))
774-
if local_var_params.get('async_req'):
774+
if _async_req:
775775
original_get = result.get
776776

777777
def translated_get(timeout=None):

0 commit comments

Comments
 (0)