Skip to content

Commit

Permalink
CLI: Fix error with setting api_key using mwdb login (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
Repumba authored Apr 4, 2023
1 parent a5777f6 commit 66dab43
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mwdblib/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.3.1"
__version__ = "4.3.2"
2 changes: 2 additions & 0 deletions mwdblib/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ def set_api_key(self, api_key: str) -> None:
self.set_auth_token(api_key)
# Store credentials in API options
self.options.api_key = api_key
if self.auth_token is not None:
self.options.username = self.auth_token.username

def logout(self) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion mwdblib/cli/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def login_command(ctx, mwdb, username, password, via_api_key, api_key):
mwdb.login(username, password)
else:
# Set API key and check if it's correct
mwdb.set_api_key(api_key)
mwdb.api.set_api_key(api_key)
mwdb.api.get("auth/validate")
except (InvalidCredentialsError, NotAuthenticatedError) as e:
click.echo("Error: Login failed - {}".format(str(e)), err=True)
Expand Down

0 comments on commit 66dab43

Please sign in to comment.