From 845f8cd6f52ff981435a3209ea0e439ee65b2c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Mon, 6 Jul 2015 18:08:56 +0200 Subject: [PATCH] Adding ssl_version parameter to Urllib3HttpConnection Fixes #246 --- elasticsearch/connection/http_urllib3.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py index eddb0b67..fab4c36b 100644 --- a/elasticsearch/connection/http_urllib3.py +++ b/elasticsearch/connection/http_urllib3.py @@ -20,12 +20,15 @@ class Urllib3HttpConnection(Connection): for instructions how to get default set :arg client_cert: path to the file containing the private key and the certificate + :arg ssl_version: version of the SSL protocol to use. Choices are: + SSLv23 (default) SSLv2 SSLv3 TLSv1 (see ``PROTOCOL_*`` constants in the + ``ssl`` module for exact options for your environment). :arg maxsize: the maximum number of connections which will be kept open to this host. """ def __init__(self, host='localhost', port=9200, http_auth=None, use_ssl=False, verify_certs=False, ca_certs=None, client_cert=None, - maxsize=10, **kwargs): + ssl_version=None, maxsize=10, **kwargs): super(Urllib3HttpConnection, self).__init__(host=host, port=port, **kwargs) self.headers = urllib3.make_headers(keep_alive=True) @@ -38,6 +41,7 @@ class Urllib3HttpConnection(Connection): kw = {} if use_ssl: pool_class = urllib3.HTTPSConnectionPool + kw['ssl_version'] = ssl_version if verify_certs: kw['cert_reqs'] = 'CERT_REQUIRED'