import logging.config from fastapi import FastAPI from fastapi.datastructures import Default from fastapi.exceptions import RequestValidationError from starlette.exceptions import HTTPException from service.api import exception_handlers from service.api.responses import JSONResponse from service.api.routers.admin import router as admin_router from service.api.routers.app import router as app_router from service.api.routers.fb import router as fb_router from service.api.routers.klaviyo import router as klaviyo_router from service.api.routers.tasks import router as tasks_router from service.conf import settings logging.config.dictConfig(settings.LOGGING) app = FastAPI( debug=settings.DEBUG, title="DataProcessor API", version="v1", default_response_class=Default(JSONResponse), exception_handlers={ RequestValidationError: exception_handlers.validation_exception_handler, HTTPException: exception_handlers.http_exception_handler, ValueError: exception_handlers.value_exception_handler, Exception: exception_handlers.exception_handler, }, ) app.include_router(app_router) app.include_router(admin_router) app.include_router(fb_router) app.include_router(klaviyo_router) app.include_router(tasks_router) # Auto import modules from . import async_tasks # noqa