Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update elastic.py #449

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion parsedmarc/elastic.py
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ class AlreadySaved(ValueError):


def set_hosts(hosts, use_ssl=False, ssl_cert_path=None,
username=None, password=None, timeout=60.0):
username=None, password=None, apiKey=None, timeout=60.0):
"""
Sets the Elasticsearch hosts to use

@@ -179,6 +179,7 @@ def set_hosts(hosts, use_ssl=False, ssl_cert_path=None,
ssl_cert_path (str): Path to the certificate chain
username (str): The username to use for authentication
password (str): The password to use for authentication
apiKey (str): The Base64 encoded API key to use for authentication
timeout (float): Timeout in seconds
"""
if not isinstance(hosts, list):
@@ -196,6 +197,8 @@ def set_hosts(hosts, use_ssl=False, ssl_cert_path=None,
conn_params['verify_certs'] = False
if username:
conn_params['http_auth'] = (username+":"+password)
if apiKey:
conn_params['api_key'] = apiKey
connections.create_connection(**conn_params)