Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 78d2ad3

Browse files
committed
working now
1 parent 4869fee commit 78d2ad3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

elasticsearch_async/connection.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ def __init__(self, host='localhost', port=9200, http_auth=None,
2929
headers.setdefault('content-type', 'application/json')
3030

3131
# if providing an SSL context, raise error if any other SSL related flag is used
32-
if ssl_context and (verify_certs or ca_certs or ssl_version):
33-
raise ImproperlyConfigured("When using `ssl_context`, `use_ssl`, `verify_certs`, `ca_certs` and `ssl_version` are not permitted")
32+
if ssl_context and (verify_certs or ca_certs):
33+
raise ImproperlyConfigured("When using `ssl_context`, `use_ssl`, `verify_certs`, `ca_certs` are not permitted")
3434

3535
if use_ssl or ssl_context:
36-
cafile = CA_CERTS if ca_certs is None else ca_certs
36+
cafile = ca_certs
3737
if not cafile and not ssl_context and verify_certs:
3838
# If no ca_certs and no sslcontext passed and asking to verify certs
3939
# raise error
4040
raise ImproperlyConfigured("Root certificates are missing for certificate "
4141
"validation. Either pass them in using the ca_certs parameter or "
4242
"install certifi to use it automatically.")
43-
if verify_certs or ca_certs or ssl_version:
44-
warnings.warn('Use of `verify_certs`, `ca_certs`, `ssl_version` have been deprecated in favor of using SSLContext`', DeprecationWarning)
43+
if verify_certs or ca_certs:
44+
warnings.warn('Use of `verify_certs`, `ca_certs` have been deprecated in favor of using SSLContext`', DeprecationWarning)
4545

4646
if not ssl_context:
4747
# if SSLContext hasn't been passed in, create one.
@@ -56,6 +56,9 @@ def __init__(self, host='localhost', port=9200, http_auth=None,
5656
ssl_context.verify_mode = ssl.CERT_NONE
5757
warnings.warn(
5858
'Connecting to %s using SSL with verify_certs=False is insecure.' % host)
59+
if ssl_context:
60+
verify_certs = True
61+
use_ssl = True
5962

6063
self.session = aiohttp.ClientSession(
6164
auth=http_auth,

0 commit comments

Comments
 (0)