Adding ssl_version parameter to Urllib3HttpConnection

Fixes #246
This commit is contained in:
Honza Král
2015-07-06 18:08:56 +02:00
parent df6e05b483
commit 845f8cd6f5
+5 -1
View File
@@ -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'