From 00fd0a95b4ecdcb9647403ee32ba677dcab1e4e9 Mon Sep 17 00:00:00 2001 From: f1delius Date: Wed, 3 Jul 2024 15:05:11 +0530 Subject: [PATCH] update email api endpoint --- src/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api.py b/src/api.py index 67986e3..de6984c 100644 --- a/src/api.py +++ b/src/api.py @@ -90,7 +90,9 @@ async def invite_bot_to_room(tool_id, session): async def enable_api(conn, userId, session): try: email_id = await session.get(f"https://bots.pixx.co/user/{userId}") - conn.execute(f"INSERT OR REPLACE INTO bot VALUES ('{userId.text}', '{email_id}')") + email_id.raise_for_status() + email = email_id.json()["email"] + conn.execute(f"INSERT OR REPLACE INTO bot VALUES ('{userId}', '{email}')") except Exception as e: logger.error(f"email api: {e}") return False