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

added encoded API key placeholder for updated api_key elasticsearch authentication. #17

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions cogstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ def __init__(self, hosts: List, username: Optional[str] = None, password: Option
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),
api_key=api_key,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the problem with this change is the fact that this still needs to work with old system as well.
Perhaps it's an underlying Elastic version that's used there. But the last time I used this at GSTT (around 6 months ago) they relied on the old authentication method - which this PR removed.
To be explicit about it, something like this would still need to work:

CogStack(hosts, username=api_username, password=api_password, api=True)

The other issue is that now, api_key is received from an * import from credentials rather than as an argument to the constructor. While this can work, it's a significant change in operations.

verify_certs=False,
timeout=timeout)
else:
Expand Down
1 change: 1 addition & 0 deletions credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
username = None
password = None

api_key = None # Encoded api key issued by your cogstack administrator.

# NLM authentication
# The UMLS REST API requires a UMLS account for the authentication described below.
Expand Down