simpserver 0.2.0__tar.gz → 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simpserver
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A simple solution to create servers http(s).
5
5
  Author-email: Manel <manelzaum@icloud.com>
6
6
  License-Expression: MIT
@@ -14,6 +14,6 @@ License-File: LICENSE
14
14
  Requires-Dist: mariadb
15
15
  Dynamic: license-file
16
16
 
17
- # SimpleServer
17
+ # SimpServer
18
18
 
19
19
  A simple solution to create simples http(s) servers.
@@ -1,3 +1,3 @@
1
- # SimpleServer
1
+ # SimpServer
2
2
 
3
3
  A simple solution to create simples http(s) servers.
@@ -7,13 +7,9 @@ include = ["simpserver*", "tests*"]
7
7
 
8
8
  [project]
9
9
  name = "simpserver"
10
- version = "0.2.0"
11
- dependencies = [
12
- "mariadb"
13
- ]
14
- authors = [
15
- { name="Manel", email="manelzaum@icloud.com" },
16
- ]
10
+ version = "0.2.1"
11
+ dependencies = ["mariadb"]
12
+ authors = [{ name="Manel", email="manelzaum@icloud.com" }]
17
13
  description = "A simple solution to create servers http(s)."
18
14
  readme = "README.md"
19
15
  requires-python = ">=3.14.2"
@@ -86,3 +86,10 @@ class DoNotExistsInDatabaseError(APIError):
86
86
  def __init__(self, table_name: str) -> None:
87
87
  super().__init__(HTTPStatus.BAD_REQUEST,
88
88
  {"message": f"Invalid primary key of {table_name}"})
89
+
90
+ class AlreadyExistsInDatabaseError(APIError):
91
+ """When something already exists in database"""
92
+
93
+ def __init__(self, table_name: str) -> None:
94
+ super().__init__(HTTPStatus.CONFLICT,
95
+ {"message": f"Primary key already exists on {table_name}"})
@@ -117,13 +117,13 @@ def route(path: str, method: HTTPMethod):
117
117
  def ensure_body_keys(keys: dict[str, type]):
118
118
  def decorator(func: RouteCallback):
119
119
  def wrapper(**kwargs) -> RouteCallbackReturn:
120
- header = kwargs["header"]
121
- header_names = header.keys()
120
+ body = kwargs["body"]
121
+ body_names = body.keys()
122
122
 
123
123
  for name, t in keys.items():
124
- if name not in header_names: raise BodyKeyMissingError(name)
124
+ if name not in body_names: raise BodyKeyMissingError(name)
125
125
 
126
- try: header[name] = t(header[name])
126
+ try: body[name] = t(body[name])
127
127
  except: raise BodyKeyTypeError(name, t)
128
128
 
129
129
  return safe_run(func, kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simpserver
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: A simple solution to create servers http(s).
5
5
  Author-email: Manel <manelzaum@icloud.com>
6
6
  License-Expression: MIT
@@ -14,6 +14,6 @@ License-File: LICENSE
14
14
  Requires-Dist: mariadb
15
15
  Dynamic: license-file
16
16
 
17
- # SimpleServer
17
+ # SimpServer
18
18
 
19
19
  A simple solution to create simples http(s) servers.
File without changes
File without changes
File without changes
File without changes
File without changes