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.
Files changed (41) hide show
  1. {wellapi-0.4.2 → wellapi-0.4.4}/PKG-INFO +1 -1
  2. {wellapi-0.4.2 → wellapi-0.4.4}/pyproject.toml +1 -1
  3. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/applications.py +6 -0
  4. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/packager.py +4 -3
  5. wellapi-0.4.4/src/wellapi/exception_handlers.py +18 -0
  6. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/models.py +2 -0
  7. {wellapi-0.4.2 → wellapi-0.4.4}/uv.lock +1 -1
  8. {wellapi-0.4.2 → wellapi-0.4.4}/.github/workflows/build.pipeline.yml +0 -0
  9. {wellapi-0.4.2 → wellapi-0.4.4}/.gitignore +0 -0
  10. {wellapi-0.4.2 → wellapi-0.4.4}/.python-version +0 -0
  11. {wellapi-0.4.2 → wellapi-0.4.4}/README.md +0 -0
  12. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/__init__.py +0 -0
  13. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/__main__.py +0 -0
  14. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/awsmodel.py +0 -0
  15. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/__init__.py +0 -0
  16. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/build/cdk.py +0 -0
  17. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/cli/__init__.py +0 -0
  18. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/cli/main.py +0 -0
  19. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/convertors.py +0 -0
  20. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/datastructures.py +0 -0
  21. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/__init__.py +0 -0
  22. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/models.py +0 -0
  23. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/dependencies/utils.py +0 -0
  24. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/exceptions.py +0 -0
  25. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/__init__.py +0 -0
  26. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/reloader.py +0 -0
  27. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/router.py +0 -0
  28. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/local/server.py +0 -0
  29. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/__init__.py +0 -0
  30. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/base.py +0 -0
  31. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/error.py +0 -0
  32. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/exceptions.py +0 -0
  33. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/middleware/main.py +0 -0
  34. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/__init__.py +0 -0
  35. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/docs.py +0 -0
  36. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/models.py +0 -0
  37. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/openapi/utils.py +0 -0
  38. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/params.py +0 -0
  39. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/routing.py +0 -0
  40. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/security.py +0 -0
  41. {wellapi-0.4.2 → wellapi-0.4.4}/src/wellapi/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wellapi
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: A simple web framework for aws lambda
5
5
  Author-email: romayuhym <romayuhym@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "wellapi"
3
- version = "0.4.2"
3
+ version = "0.4.4"
4
4
  description = "A simple web framework for aws lambda"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -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).startswith("wellapi.out/")
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
+ )
@@ -79,6 +79,8 @@ class ResponseAPIGateway:
79
79
  def to_aws_response(self):
80
80
  if isinstance(self.body, str):
81
81
  body = self.body
82
+ elif self.body is None:
83
+ body = None
82
84
  else:
83
85
  body = json.dumps(self.body)
84
86
 
@@ -328,7 +328,7 @@ wheels = [
328
328
 
329
329
  [[package]]
330
330
  name = "wellapi"
331
- version = "0.4.2"
331
+ version = "0.4.4"
332
332
  source = { editable = "." }
333
333
  dependencies = [
334
334
  { name = "email-validator" },
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