|
@@ -1,30 +1,44 @@
|
|
|
import logging
|
|
|
-from typing import Any, Callable, Dict, List, Optional, Set
|
|
|
+from typing import Any
|
|
|
+from typing import Callable
|
|
|
+from typing import Dict
|
|
|
+from typing import List
|
|
|
+from typing import Optional
|
|
|
+from typing import Set
|
|
|
|
|
|
from asgiref.sync import sync_to_async
|
|
|
-from fastapi import Depends, FastAPI, Request
|
|
|
-from fastapi.exceptions import HTTPException, RequestValidationError
|
|
|
+from fastapi import Depends
|
|
|
+from fastapi import FastAPI
|
|
|
+from fastapi import Request
|
|
|
+from fastapi.exceptions import HTTPException
|
|
|
+from fastapi.exceptions import RequestValidationError
|
|
|
from fastapi.security import OAuth2AuthorizationCodeBearer
|
|
|
-from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
|
|
|
+from starlette.status import HTTP_401_UNAUTHORIZED
|
|
|
+from starlette.status import HTTP_403_FORBIDDEN
|
|
|
from starlette.types import ASGIApp
|
|
|
|
|
|
+from clean_python.base.domain.exceptions import Conflict
|
|
|
+from clean_python.base.domain.exceptions import DoesNotExist
|
|
|
+from clean_python.base.domain.exceptions import PermissionDenied
|
|
|
+from clean_python.base.domain.exceptions import Unauthorized
|
|
|
+from clean_python.base.infrastructure.gateway import Gateway
|
|
|
+from clean_python.oauth2.oauth2 import OAuth2AccessTokenVerifier
|
|
|
+from clean_python.oauth2.oauth2 import OAuth2Settings
|
|
|
+
|
|
|
from .context import RequestMiddleware
|
|
|
-from .error_responses import (
|
|
|
- BadRequest,
|
|
|
- conflict_handler,
|
|
|
- DefaultErrorResponse,
|
|
|
- not_found_handler,
|
|
|
- not_implemented_handler,
|
|
|
- permission_denied_handler,
|
|
|
- unauthorized_handler,
|
|
|
- validation_error_handler,
|
|
|
- ValidationErrorResponse,
|
|
|
-)
|
|
|
-from clean_python.base.domain.exceptions import Conflict, DoesNotExist, PermissionDenied, Unauthorized
|
|
|
+from .error_responses import BadRequest
|
|
|
+from .error_responses import conflict_handler
|
|
|
+from .error_responses import DefaultErrorResponse
|
|
|
+from .error_responses import not_found_handler
|
|
|
+from .error_responses import not_implemented_handler
|
|
|
+from .error_responses import permission_denied_handler
|
|
|
+from .error_responses import unauthorized_handler
|
|
|
+from .error_responses import validation_error_handler
|
|
|
+from .error_responses import ValidationErrorResponse
|
|
|
from .fastapi_access_logger import FastAPIAccessLogger
|
|
|
-from clean_python.base.infrastructure.gateway import Gateway
|
|
|
-from clean_python.oauth2.oauth2 import OAuth2AccessTokenVerifier, OAuth2Settings
|
|
|
-from .resource import APIVersion, clean_resources, Resource
|
|
|
+from .resource import APIVersion
|
|
|
+from .resource import clean_resources
|
|
|
+from .resource import Resource
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|