From 46cbbd749c937142c6d958fcb74e801a38036eaf Mon Sep 17 00:00:00 2001 From: rmanach Date: Wed, 18 Dec 2024 14:58:08 +0100 Subject: [PATCH] fix typo --- src/client.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client.py b/src/client.py index d333cfe..6fbd58b 100644 --- a/src/client.py +++ b/src/client.py @@ -24,7 +24,7 @@ __all__ = ["Client", "OrderField"] def refresh(): """ Catch 401 status code (UnauthorizedException) - and refresh the access token and retry. + refresh the access token and retry. """ def decorator(func): @@ -183,7 +183,7 @@ class Client: Initialize the client from env variables (.env & global) and log in into the application. - If the login fails, and exception is raised. + If the login fails, an exception is raised. """ env_data = { "WHEREIS_API_EMAIL": os.getenv("WHEREIS_API_EMAIL", ""), @@ -337,7 +337,8 @@ class Client: @refresh() def delete_session(self, id_: UUID) -> None | WhereIsException: """ - Close and delete the session. Users can't be added anymore. + Close and delete the session. + NOTE: The GPS positions associated to the session are not deleted ! """ session_url = urljoin(self.base_url, f"/sessions/{id_}/") @@ -377,6 +378,7 @@ class Client: @refresh() def close_session(self, id_: UUID) -> dict[str, Any] | WhereIsException: + """Close the DEFINITIVELY the session. Users can't be added anymore.""" session_url = urljoin(self.base_url, f"/sessions/{id_}/close/") logging.info(f"close session: {session_url}") @@ -495,7 +497,9 @@ class Client: return None @refresh() - def _get_paginate_gps_postions(self, url: str) -> dict[str, Any] | WhereIsException: + def _get_paginate_gps_positions( + self, url: str + ) -> dict[str, Any] | WhereIsException: res = self.session.get(url) if res.status_code == 401: @@ -539,7 +543,7 @@ class Client: while gps_url is not None: logging.info(f"get gps data from: {gps_url}") - data = self._get_paginate_gps_postions(gps_url) + data = self._get_paginate_gps_positions(gps_url) lst_gps_positions.extend([d for d in data["results"]]) gps_url = data["next"]