From b5c6535ee85bbe5439ed21032c17a33192b9acef Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 16 Dec 2024 20:14:11 +0300 Subject: [PATCH] wh5 --- services/webhook.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/webhook.py b/services/webhook.py index 358a5dd0..68840b4a 100644 --- a/services/webhook.py +++ b/services/webhook.py @@ -25,7 +25,10 @@ async def check_webhook_existence(): tuple: (bool, str, str) - существует ли вебхук, его id и endpoint если существует """ logger.info("check_webhook_existence called") - + if not ADMIN_SECRET: + logger.error("ADMIN_SECRET is not set") + return False, None, None + headers = { "Content-Type": "application/json", "X-Authorizer-Admin-Secret": ADMIN_SECRET @@ -45,8 +48,8 @@ async def check_webhook_existence(): } result = await request_graphql_data(gql, headers=headers) if result: - logger.info(result) webhooks = result.get("data", {}).get(query_name, {}).get("webhooks", []) + logger.info(webhooks) for webhook in webhooks: if webhook["event_name"].startswith("user.login"): return True, webhook["id"], webhook["endpoint"]