This commit is contained in:
parent
cf6150b155
commit
b5c6535ee8
|
@ -25,7 +25,10 @@ async def check_webhook_existence():
|
||||||
tuple: (bool, str, str) - существует ли вебхук, его id и endpoint если существует
|
tuple: (bool, str, str) - существует ли вебхук, его id и endpoint если существует
|
||||||
"""
|
"""
|
||||||
logger.info("check_webhook_existence called")
|
logger.info("check_webhook_existence called")
|
||||||
|
if not ADMIN_SECRET:
|
||||||
|
logger.error("ADMIN_SECRET is not set")
|
||||||
|
return False, None, None
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Authorizer-Admin-Secret": ADMIN_SECRET
|
"X-Authorizer-Admin-Secret": ADMIN_SECRET
|
||||||
|
@ -45,8 +48,8 @@ async def check_webhook_existence():
|
||||||
}
|
}
|
||||||
result = await request_graphql_data(gql, headers=headers)
|
result = await request_graphql_data(gql, headers=headers)
|
||||||
if result:
|
if result:
|
||||||
logger.info(result)
|
|
||||||
webhooks = result.get("data", {}).get(query_name, {}).get("webhooks", [])
|
webhooks = result.get("data", {}).get(query_name, {}).get("webhooks", [])
|
||||||
|
logger.info(webhooks)
|
||||||
for webhook in webhooks:
|
for webhook in webhooks:
|
||||||
if webhook["event_name"].startswith("user.login"):
|
if webhook["event_name"].startswith("user.login"):
|
||||||
return True, webhook["id"], webhook["endpoint"]
|
return True, webhook["id"], webhook["endpoint"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user