wellapi 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wellapi-0.4.2 → wellapi-0.4.4}/PKG-INFO +1 -1
- {wellapi-0.4.2 → wellapi-0.4.4}/pyproject.toml +1 -1
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/applications.py +6 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/packager.py +4 -3
- wellapi-0.4.4/src/wellapi/exception_handlers.py +18 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/models.py +2 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/uv.lock +1 -1
- {wellapi-0.4.2 → wellapi-0.4.4}/.github/workflows/build.pipeline.yml +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/.gitignore +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/.python-version +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/README.md +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/__main__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/awsmodel.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/cdk.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/cli/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/cli/main.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/convertors.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/datastructures.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/models.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/utils.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/exceptions.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/reloader.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/router.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/server.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/base.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/error.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/exceptions.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/main.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/__init__.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/docs.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/models.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/utils.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/params.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/routing.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/security.py +0 -0
- {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/utils.py +0 -0
|
@@ -18,6 +18,8 @@ from wellapi.dependencies.utils import (
|
|
|
18
18
|
get_parameterless_sub_dependant,
|
|
19
19
|
get_typed_return_annotation,
|
|
20
20
|
)
|
|
21
|
+
from wellapi.exception_handlers import http_exception_handler, request_validation_exception_handler
|
|
22
|
+
from wellapi.exceptions import HTTPException, RequestValidationError
|
|
21
23
|
from wellapi.middleware.base import BaseMiddleware
|
|
22
24
|
from wellapi.middleware.error import ServerErrorMiddleware
|
|
23
25
|
from wellapi.middleware.exceptions import ExceptionMiddleware
|
|
@@ -196,6 +198,10 @@ class WellApi:
|
|
|
196
198
|
):
|
|
197
199
|
self.lambdas = []
|
|
198
200
|
self.exception_handlers = {}
|
|
201
|
+
self.exception_handlers.setdefault(HTTPException, http_exception_handler)
|
|
202
|
+
self.exception_handlers.setdefault(
|
|
203
|
+
RequestValidationError, request_validation_exception_handler
|
|
204
|
+
)
|
|
199
205
|
self.user_middleware = []
|
|
200
206
|
self.debug = debug
|
|
201
207
|
self.title = title
|
|
@@ -56,9 +56,10 @@ def create_zip(file_name: str, dir_name: str):
|
|
|
56
56
|
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as z:
|
|
57
57
|
for path in Path(dir_name).rglob("*"):
|
|
58
58
|
if (
|
|
59
|
-
str(path).startswith(".venv
|
|
60
|
-
or str(path).startswith("cdk.out
|
|
61
|
-
or str(path)
|
|
59
|
+
str(path).startswith(".venv")
|
|
60
|
+
or str(path).startswith("cdk.out")
|
|
61
|
+
or "__pycache__" in str(path)
|
|
62
|
+
or str(path) == file_name
|
|
62
63
|
):
|
|
63
64
|
continue
|
|
64
65
|
z.write(path, path.relative_to(Path(dir_name).parent))
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from wellapi.models import RequestAPIGateway, ResponseAPIGateway
|
|
2
|
+
from wellapi.exceptions import HTTPException, RequestValidationError
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def http_exception_handler(request: RequestAPIGateway, exc: HTTPException) -> ResponseAPIGateway:
|
|
6
|
+
headers = getattr(exc, "headers", None)
|
|
7
|
+
return ResponseAPIGateway(
|
|
8
|
+
{"detail": exc.detail}, status_code=exc.status_code, headers=headers
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def request_validation_exception_handler(
|
|
13
|
+
request: RequestAPIGateway, exc: RequestValidationError
|
|
14
|
+
) -> ResponseAPIGateway:
|
|
15
|
+
return ResponseAPIGateway(
|
|
16
|
+
status_code=422,
|
|
17
|
+
content={"detail": exc.errors()},
|
|
18
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|