Skip to content

Commit 8c23958

Browse files
feat: optional parameter to allow basic auth
1 parent df847be commit 8c23958

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

influxdb_client/client/influxdb_client.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from __future__ import absolute_import
44

55
import configparser
6-
import os, base64
6+
import os
7+
import base64
78

89
from influxdb_client import Configuration, ApiClient, HealthCheck, HealthService, Ready, ReadyService
910
from influxdb_client.client.authorizations_api import AuthorizationsApi
@@ -66,12 +67,10 @@ def __init__(self, url, token, debug=None, timeout=10_000, enable_gzip=False, or
6667
auth_header_name = "Authorization"
6768
auth_header_value = "Token " + auth_token
6869

69-
# allow basic authentication for cases where InfluxDB (backwards 1.8 doesn't use auth but proxies perform basic auth)
7070
auth_basic = kwargs.get('auth_basic', False)
7171
if auth_basic:
7272
auth_header_value = "Basic " + base64.b64encode(token.encode()).decode()
7373

74-
7574
retries = kwargs.get('retries', False)
7675

7776
self.api_client = ApiClient(configuration=conf, header_name=auth_header_name,

0 commit comments

Comments
 (0)