File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ DATABASE_PORT=3306
44DATABASE_USER = " "
55DATABASE_PASSWD = " "
66
7+ NOTIFY_ADMIN_URL = " "
8+
79STATIC_APP_DIR = " /app/static"
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class Settings(BaseSettings):
1010
1111 static_app_dir : str
1212
13+ notify_admin_url : str
14+
1315 class Config :
1416 env_file = ".env"
1517
Original file line number Diff line number Diff line change 1+ from fastapi import Request , APIRouter
2+ from aiohttp import ClientSession
3+ from loguru import logger
4+
5+ from src .config import settings
6+
7+ router = APIRouter ()
8+
9+ @router .post ("/notify_admin" )
10+ async def notify_admin (request : Request ):
11+ body = await request .json ()
12+ logger .info (str (body ))
13+
14+ try :
15+ async with ClientSession () as session :
16+ async with session .post (
17+ settings .notify_admin_url , json = body
18+ ) as response :
19+ pass
20+ except Exception as e :
21+ logger .error (f"notify_admin error: { e } , body: f{ body } " )
You can’t perform that action at this time.
0 commit comments