From c6336d0902be6bef5e253c3d1dc5fc356570d4e0 Mon Sep 17 00:00:00 2001 From: benjaminastrand Date: Tue, 3 Dec 2024 15:57:09 +0100 Subject: [PATCH] Only get session_id from POST response if request is successful --- fedn/network/api/client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fedn/network/api/client.py b/fedn/network/api/client.py index aca36cbdc..344ae6453 100644 --- a/fedn/network/api/client.py +++ b/fedn/network/api/client.py @@ -645,10 +645,9 @@ def start_session( headers=self.headers, ) - if id is None: - id = response.json()["session_id"] - if response.status_code == 201: + if id is None: + id = response.json()["session_id"] response = requests.post( self._get_url_api_v1("sessions/start"), json={