Use HTTP Basic Authentication instead of passing the credentials in the URL

This commit is contained in:
Itai Shirav 2019-02-26 23:12:32 +02:00
parent 81e942a4d2
commit b8fd39c6a6
2 changed files with 3 additions and 6 deletions

View File

@ -6,6 +6,7 @@ Unreleased
- Extend date field range (trthhrtz)
- Fix parsing of server errors in ClickHouse v19.3.3+
- Fix pagination when asking for the last page on a query that matches no records
- Use HTTP Basic Authentication instead of passing the credentials in the URL
v1.0.4
------

View File

@ -99,12 +99,12 @@ class Database(object):
'''
self.db_name = db_name
self.db_url = db_url
self.username = username
self.password = password
self.readonly = False
self.timeout = timeout
self.request_session = requests.Session()
self.request_session.verify = verify_ssl_cert
if username:
self.request_session.auth = (username, password or '')
self.settings = {}
self.db_exists = False # this is required before running _is_existing_database
self.db_exists = self._is_existing_database()
@ -345,10 +345,6 @@ class Database(object):
params.update(self.settings)
if self.db_exists:
params['database'] = self.db_name
if self.username:
params['user'] = self.username
if self.password:
params['password'] = self.password
# Send the readonly flag, unless the connection is already readonly (to prevent db error)
if self.readonly and not self.connection_readonly:
params['readonly'] = '1'