Skip to content

Commit

Permalink
Merge pull request #247 from Axonius/bugfix/service_account_login_error
Browse files Browse the repository at this point in the history
5.0.3
  • Loading branch information
Jim Olsen committed May 10, 2023
2 parents d74abb7 + fc70fc3 commit 922b148
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions axonius_api_client/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,12 @@ def api_keys(self) -> dict:
return self.AUTH.get_api_keys()

@property
def current_user(self) -> api.json_api.account.CurrentUser:
"""Get the current user."""
return self.AUTH.get_current_user()
def current_user(self) -> t.Optional[api.json_api.account.CurrentUser]:
"""Get the current user (returns 404 for service accounts)."""
try:
return self.AUTH.get_current_user()
except Exception:
return None

@property
def about(self):
Expand Down Expand Up @@ -714,7 +717,8 @@ def str_ax_user(self) -> str:
"""Get the Axonius instance user for use in str."""
value = "User: ??"
if self.STARTED:
value = self.current_user.str_connect
if self.current_user:
value = self.current_user.str_connect
return value

@property
Expand Down
2 changes: 1 addition & 1 deletion axonius_api_client/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Version information for this package."""
__version__ = "5.0.2"
__version__ = "5.0.3"
VERSION: str = __version__
"""Version of package."""

Expand Down

0 comments on commit 922b148

Please sign in to comment.