Skip to content

Commit

Permalink
increase timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
antsh3k committed Jan 10, 2025
1 parent 08d65ed commit 8286c3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cogstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ class CogStack(object):
api (bool, optional): A boolean value indicating whether to use API keys or basic authentication to connect to Elasticsearch. Defaults to False (i.e., use basic authentication).
"""
def __init__(self, hosts: List, username: Optional[str] = None, password: Optional[str] = None,
api: bool = False):
api: bool = False, timeout: Optional[int]=60):

if api:
api_username, api_password = self._check_auth_details(username, password)
self.elastic = elasticsearch.Elasticsearch(hosts=hosts,
api_key=(api_username, api_password),
verify_certs=False)
verify_certs=False,
timeout=timeout)
else:
username, password = self._check_auth_details(username, password)
self.elastic = elasticsearch.Elasticsearch(hosts=hosts,
basic_auth=(username, password),
verify_certs=False)
verify_certs=False,
timeout=timeout)


def _check_auth_details(self, username=None, password=None) -> Tuple[str, str]:
Expand Down

0 comments on commit 8286c3e

Please sign in to comment.