diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-07-16 08:17:06 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-07-16 08:27:12 +0300 |
commit | 6030fb6e3d072018ef2636ff67bd98e7421c65ca (patch) | |
tree | fa3086ce3858cdacec609dd58490b616f450f821 /contrib | |
parent | fdd485483af48d36d003ff9330069a8307030876 (diff) | |
download | ydb-6030fb6e3d072018ef2636ff67bd98e7421c65ca.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib')
5 files changed, 22 insertions, 15 deletions
diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index c82123d9e2..dac0751d94 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.7.14 +Version: 0.7.15 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index 3c2c07c720..8dec87cb67 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.7.14' +version = '0.7.15' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/common.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/common.py index 84a91c9415..dca0dc9317 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/common.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/common.py @@ -112,6 +112,12 @@ def dict_copy(source: Dict = None, update: Optional[Dict] = None) -> Dict: return copy +def dict_add(source: Dict, key: str, value: any) -> Dict: + if value is not None: + source[key] = value + return source + + def empty_gen(): yield from () diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py index 0af2612f93..03b5bbe324 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py @@ -16,7 +16,7 @@ from clickhouse_connect import common from clickhouse_connect.datatypes import registry from clickhouse_connect.datatypes.base import ClickHouseType from clickhouse_connect.driver.client import Client -from clickhouse_connect.driver.common import dict_copy, coerce_bool, coerce_int +from clickhouse_connect.driver.common import dict_copy, coerce_bool, coerce_int, dict_add from clickhouse_connect.driver.compression import available_compression from clickhouse_connect.driver.ctypes import RespBuffCls from clickhouse_connect.driver.exceptions import DatabaseError, OperationalError, ProgrammingError @@ -58,7 +58,7 @@ class HttpClient(Client): connect_timeout: int = 10, send_receive_timeout: int = 300, client_name: Optional[str] = None, - verify: bool = True, + verify: Union[bool, str] = True, ca_cert: Optional[str] = None, client_cert: Optional[str] = None, client_cert_key: Optional[str] = None, @@ -81,22 +81,23 @@ class HttpClient(Client): if interface == 'https': if not https_proxy: https_proxy = check_env_proxy('https', host, port) - if client_cert: + if https_proxy and isinstance(verify, str) and verify.lower() == 'proxy': + verify = 'proxy' + else: + verify = coerce_bool(verify) + if client_cert and verify != 'proxy': if not username: raise ProgrammingError('username parameter is required for Mutual TLS authentication') self.headers['X-ClickHouse-User'] = username self.headers['X-ClickHouse-SSL-Certificate-Auth'] = 'on' - verify = coerce_bool(verify) # pylint: disable=too-many-boolean-expressions if not self.http and (server_host_name or ca_cert or client_cert or not verify or https_proxy): - options = { - 'ca_cert': ca_cert, - 'client_cert': client_cert, - 'verify': verify, - 'client_cert_key': client_cert_key - } + options = {'verify': verify is not False} + dict_add(options,'ca_cert', ca_cert) + dict_add(options, 'client_cert', client_cert) + dict_add(options, 'client_cert_key', client_cert_key) if server_host_name: - if verify: + if options['verify']: options['assert_hostname'] = server_host_name options['server_hostname'] = server_host_name self.http = get_pool_manager(https_proxy=https_proxy, **options) @@ -109,7 +110,7 @@ class HttpClient(Client): else: self.http = default_pool_manager() - if not client_cert and username: + if (not client_cert or verify == 'proxy') and username: self.headers['Authorization'] = 'Basic ' + b64encode(f'{username}:{password}'.encode()).decode() self.headers['User-Agent'] = common.build_client_name(client_name) self._read_format = self._write_format = 'Native' diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index f7a5184c3b..a1b0d07909 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.7.14) +VERSION(0.7.15) LICENSE(Apache-2.0) |