From f4fd8f752b1e0764edb5ce9b5f3ab5dc029336d9 Mon Sep 17 00:00:00 2001 From: SumanMaharana Date: Fri, 22 Nov 2024 20:07:20 +0530 Subject: [PATCH] Fix pytests --- ingestion/src/metadata/ingestion/ometa/client.py | 6 ++---- .../src/metadata/ingestion/source/dashboard/mstr/client.py | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ingestion/src/metadata/ingestion/ometa/client.py b/ingestion/src/metadata/ingestion/ometa/client.py index 1a79fa498851..589b09866c7a 100644 --- a/ingestion/src/metadata/ingestion/ometa/client.py +++ b/ingestion/src/metadata/ingestion/ometa/client.py @@ -247,11 +247,9 @@ def _one_request(self, method: str, url: URL, opts: dict, retry: int): resp = self._session.request(method, url, **opts) resp.raise_for_status() - # resp.status_code: 204 => True when request call is successful with no content returned - # the content is passed through resp.headers - if resp.text != "" or resp.status_code == 204: + if resp.text != "": try: - return resp.json() if resp.text != "" else resp + return resp.json() except Exception as exc: logger.debug(traceback.format_exc()) logger.warning( diff --git a/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py b/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py index 5d5dadb2b3e7..1388364db11c 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/mstr/client.py @@ -103,7 +103,12 @@ def _set_api_session(self) -> bool: """ Set the user api session to active this will keep the connection alive """ - api_session = self.client.put(path="/sessions") + api_session = requests.put( + url=self._get_base_url("sessions"), + headers=self.auth_params.auth_header, + cookies=self.auth_params.auth_cookies, + timeout=60, + ) if api_session.ok: logger.info( f"Connection Successful User {self.config.username} is Authenticated"