From 28d5332b68df2e3703dabdaff5946877bbe7da75 Mon Sep 17 00:00:00 2001 From: Leo Dirac Date: Tue, 13 Feb 2024 14:56:57 -0800 Subject: [PATCH] WIP whoami for issue #64 --- src/groundlight/client.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/groundlight/client.py b/src/groundlight/client.py index 244a4c0d..22690da0 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -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, @@ -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 """