From f6696b8a3396f71281f31047d49e5a1162e99712 Mon Sep 17 00:00:00 2001 From: jkmin3 Date: Fri, 29 Mar 2024 13:32:43 -0500 Subject: [PATCH] when data is none, better handling --- ai_ta_backend/flows.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ai_ta_backend/flows.py b/ai_ta_backend/flows.py index 1f1b42b5..aa436b38 100644 --- a/ai_ta_backend/flows.py +++ b/ai_ta_backend/flows.py @@ -166,10 +166,13 @@ def main_flow(self, name: str, api_key: str = "", data: str = ""): hook = self.url + f"/webhook/{hookId}" print("Hook!!!: ", hook) print(data) - json_data = json.loads(data) - print("Data to json") - new_data = dict(json_data) - print("Got data to dictionary") + if data: + json_data = json.loads(data) + print("Data to json") + new_data = dict(json_data) + print("Got data to dictionary") + else: + new_data = None response = self.supabase_client.table('n8n_api_keys').select("*").execute() print("Got response")