Skip to content

Commit

Permalink
WIP whoami for issue #64
Browse files Browse the repository at this point in the history
  • Loading branch information
robotrapta committed Feb 13, 2024
1 parent 9eee49d commit 28d5332
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/groundlight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ def __init__(
disable_tls_verification: Optional[bool] = None,
) -> None:
"""
Constructs a Groundlight client.
:param endpoint: optionally specify a different endpoint
Constructs a Groundlight SDK client.
:param api_token: use this API token for your API calls.
If unset, fallback to the environment variable "GROUNDLIGHT_API_TOKEN".
:param endpoint: optionally specify a different endpoint, such as for an Edge device
:param disable_tls_verification: Set this to `True` to skip verifying SSL/TLS certificates
when calling API from https server. If unset, the fallback will check
the environment variable "DISABLE_TLS_VERIFY" for `1` or `0`. By default,
Expand Down Expand Up @@ -142,11 +142,17 @@ def _fixup_image_query(iq: ImageQuery) -> ImageQuery:
iq.result.label = convert_internal_label_to_display(iq, iq.result.label)
return iq

def whoami(self) -> dict[str, str]:
"""
Return info about the currently logged in user, based on the API token.
"""
return self.api_client.whoami()

def get_detector(self, id: Union[str, Detector]) -> Detector: # pylint: disable=redefined-builtin
"""
Get a detector by id
:param id: the detector id
:param id: the detector id as a string, or a Detector object
:return: Detector
"""
Expand Down

0 comments on commit 28d5332

Please sign in to comment.