Skip to content

Commit

Permalink
add parameter to set SSL certificate validation policy
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0nx committed Feb 11, 2014
1 parent 8ebd14e commit 83a51b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pyes/connection_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@

POOLS = {}

CERT_REQS = 'CERT_OPTIONAL'

def get_pool():
if not current_process() in POOLS:
POOLS[current_process()] = urllib3.PoolManager()
POOLS[current_process()] = urllib3.PoolManager(cert_reqs=CERT_REQS)
return POOLS[current_process()]

def update_connection_pool(maxsize=1):
Expand Down
6 changes: 5 additions & 1 deletion pyes/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import json

from . import logger
from . import connection_http
from .connection_http import connect as http_connect
from .convert_errors import raise_if_error
#from .decorators import deprecated
Expand Down Expand Up @@ -138,7 +139,8 @@ def __init__(self, server="localhost:9200", timeout=30.0, bulk_size=400,
basic_auth=None,
raise_on_bulk_item_failure=False,
document_object_field=None,
bulker_class=ListBulker):
bulker_class=ListBulker,
cert_reqs='CERT_OPTIONAL'):
"""
Init a es object.
Servers can be defined in different forms:
Expand Down Expand Up @@ -204,6 +206,8 @@ def __init__(self, server="localhost:9200", timeout=30.0, bulk_size=400,
self.bulker_class = bulker_class
self._raise_on_bulk_item_failure = raise_on_bulk_item_failure

connection_http.CERT_REQS = cert_reqs

self.info = {} #info about the current server
if encoder:
self.encoder = encoder
Expand Down

0 comments on commit 83a51b5

Please sign in to comment.