Skip to content

Commit

Permalink
fixed es auth issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Apr 15, 2022
1 parent 856a55a commit eed56fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/crawlab/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '0.3.5'
VERSION = '0.3.6'
13 changes: 7 additions & 6 deletions python/crawlab/db/es.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import json

import elasticsearch as elasticsearch

from crawlab.utils.config import get_data_source


def get_client() -> elasticsearch.Elasticsearch:
ds = get_data_source()
base_auth = None
http_auth = None
if ds.get('username') is not None and ds.get('password') is not None:
base_auth = (ds.get('username'), ds.get('password'))
http_auth = f'{ds.get("username")}:{ds.get("password")}'
return elasticsearch.Elasticsearch(
hosts=[{'host': ds.get('host'), 'port': ds.get('port')}],
basic_auth=base_auth,
hosts=[{
'host': ds.get('host'),
'port': ds.get('port'),
'http_auth': http_auth,
}],
)


Expand Down

0 comments on commit eed56fa

Please sign in to comment.