feat api 调用次数记录

fix
This commit is contained in:
zhouchengrong
2024-09-23 10:47:34 +08:00
parent a656c6e9bc
commit 654f67f0e7
2 changed files with 46 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ from fastapi import FastAPI
from app.api.api_route import router
from app.core.config import settings
from app.core.record_api_count import count_api_calls
from app.schemas.response_template import ResponseModel
from logging_env import LOGGER_CONFIG_DICT
@@ -34,6 +35,7 @@ def get_application() -> FastAPI:
allow_methods=["*"],
allow_headers=["*"],
)
application.middleware("http")(count_api_calls)
application.include_router(router=router, prefix=settings.API_PREFIX)
return application