edri 2025.10.2rc1__py3-none-any.whl → 2025.11.1rc2__py3-none-any.whl
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.
- edri/api/handlers/http_handler.py +1 -1
- edri/api/listener.py +23 -19
- edri/utility/validation.py +14 -7
- {edri-2025.10.2rc1.dist-info → edri-2025.11.1rc2.dist-info}/METADATA +1 -1
- {edri-2025.10.2rc1.dist-info → edri-2025.11.1rc2.dist-info}/RECORD +7 -7
- {edri-2025.10.2rc1.dist-info → edri-2025.11.1rc2.dist-info}/WHEEL +0 -0
- {edri-2025.10.2rc1.dist-info → edri-2025.11.1rc2.dist-info}/top_level.txt +0 -0
|
@@ -486,7 +486,7 @@ class HTTPHandler[T: HTTPResponseDirective](BaseHandler, ABC):
|
|
|
486
486
|
|
|
487
487
|
async def parse_body(self, event: Type[Event]) -> None:
|
|
488
488
|
if not self.headers["content-type"]:
|
|
489
|
-
|
|
489
|
+
self.headers["content-type"] = ["application/octet-stream"]
|
|
490
490
|
|
|
491
491
|
if event._is_file_only is None:
|
|
492
492
|
while self.body.tell() < MAX_BODY_SIZE:
|
edri/api/listener.py
CHANGED
|
@@ -179,25 +179,29 @@ class Listener(Process):
|
|
|
179
179
|
})
|
|
180
180
|
return
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
182
|
+
content_lengths = handler.headers.get("content-length")
|
|
183
|
+
if content_lengths:
|
|
184
|
+
content_length = int(content_lengths[0])
|
|
185
|
+
if content_length > 0:
|
|
186
|
+
try:
|
|
187
|
+
await handler.parse_body(event_constructor)
|
|
188
|
+
except Exception as e:
|
|
189
|
+
self.logger.error("Parse of body failed", exc_info=e)
|
|
190
|
+
reasons = [{
|
|
191
|
+
"status_code": HTTPStatus.BAD_REQUEST,
|
|
192
|
+
"message": "Parse of body failed",
|
|
193
|
+
}]
|
|
194
|
+
current_exception = e
|
|
195
|
+
while current_exception:
|
|
196
|
+
reasons.append({
|
|
197
|
+
"message": str(current_exception),
|
|
198
|
+
})
|
|
199
|
+
current_exception = current_exception.__context__
|
|
200
|
+
await handler.response_error(HTTPStatus.BAD_REQUEST, {
|
|
201
|
+
"reasons": reasons
|
|
202
|
+
})
|
|
203
|
+
return
|
|
204
|
+
|
|
201
205
|
# Create Event
|
|
202
206
|
try:
|
|
203
207
|
event = handler.create_event(event_constructor)
|
edri/utility/validation.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from datetime import date, datetime, time
|
|
2
2
|
from re import Pattern
|
|
3
|
+
from typing import Self
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
class StringValidation(str):
|
|
@@ -11,7 +12,7 @@ class StringValidation(str):
|
|
|
11
12
|
- Minimum and maximum allowed lengths.
|
|
12
13
|
|
|
13
14
|
Args:
|
|
14
|
-
|
|
15
|
+
value (str): The input string to validate.
|
|
15
16
|
maximum_length (int, optional): Maximum allowed length of the string.
|
|
16
17
|
minimum_length (int, optional): Minimum required length of the string.
|
|
17
18
|
regex (Pattern, optional): A compiled regex pattern the string must match.
|
|
@@ -27,20 +28,26 @@ class StringValidation(str):
|
|
|
27
28
|
def __new__(cls, value, /, *,
|
|
28
29
|
maximum_length: int = None,
|
|
29
30
|
minimum_length: int = None,
|
|
30
|
-
regex: Pattern | None = None,
|
|
31
|
-
):
|
|
31
|
+
regex: Pattern[str] | None = None,
|
|
32
|
+
) -> Self:
|
|
32
33
|
|
|
33
34
|
value = super().__new__(cls, value)
|
|
34
35
|
if regex is not None:
|
|
35
|
-
if not regex.
|
|
36
|
-
raise ValueError(
|
|
36
|
+
if not regex.fullmatch(value):
|
|
37
|
+
raise ValueError(
|
|
38
|
+
f"Invalid data provided. Data '{cls.safe_val(value)}' does not match pattern '{regex.pattern}'")
|
|
37
39
|
if minimum_length is not None and len(value) < minimum_length:
|
|
38
|
-
raise ValueError(f"Invalid data provided. Data '{value}' is too short")
|
|
40
|
+
raise ValueError(f"Invalid data provided. Data '{cls.safe_val(value)}' is too short")
|
|
39
41
|
if maximum_length is not None and len(value) > maximum_length:
|
|
40
|
-
raise ValueError(f"Invalid data provided. Data '{value}' is too long")
|
|
42
|
+
raise ValueError(f"Invalid data provided. Data '{cls.safe_val(value)}' is too long")
|
|
41
43
|
|
|
42
44
|
return value
|
|
43
45
|
|
|
46
|
+
@staticmethod
|
|
47
|
+
def safe_val(v, max_len=20):
|
|
48
|
+
"""Return truncated display string, not full content."""
|
|
49
|
+
return (v[:max_len] + "…") if len(v) > max_len else v
|
|
50
|
+
|
|
44
51
|
|
|
45
52
|
class IntegerValidation(int):
|
|
46
53
|
"""
|
|
@@ -10,7 +10,7 @@ edri/abstract/worker/worker_process.py,sha256=QiNxOuwkMds0sV2MBLyp7bjrovm5xColC7
|
|
|
10
10
|
edri/abstract/worker/worker_thread.py,sha256=xoMPuDn-hAkWk6kFY3Xf8mxOVP__5t7-x7f-b396-8M,2176
|
|
11
11
|
edri/api/__init__.py,sha256=ZDxCpHKFGajJ1RwDpV7CzxLDUaKpozJRfOCv1OPv5ZY,142
|
|
12
12
|
edri/api/broker.py,sha256=6O-B2Io7WF9KPXJCXsCzcyxpwjieIx5vqR06cSEi1oI,37276
|
|
13
|
-
edri/api/listener.py,sha256=
|
|
13
|
+
edri/api/listener.py,sha256=QaBlrlWH8j5OsD0mFMeTd95eP2nq7J-B6FCPL9OtFac,20289
|
|
14
14
|
edri/api/middleware.py,sha256=6_x55swthVDczT-fu_1ufY1cDsHTZ04jMx6J6xfjbsM,5483
|
|
15
15
|
edri/api/dataclass/__init__.py,sha256=8Y-zcaJtzMdALnNG7M9jsCaB1qAJKM8Ld3h9MDajYjA,292
|
|
16
16
|
edri/api/dataclass/api_event.py,sha256=NzS-BCw9DYy3QGlLJVDmL7RyJ0yH8stKcV_3io6sa3w,6085
|
|
@@ -22,7 +22,7 @@ edri/api/extensions/url_prefix.py,sha256=kNI6g5ZlW0w-J_IMacYLco1EQvmTtMJyEkN6-SK
|
|
|
22
22
|
edri/api/handlers/__init__.py,sha256=MI6OGDf1rM8jf_uCKK_JYeOGMts62CNy10BwwNlG0Tk,200
|
|
23
23
|
edri/api/handlers/base_handler.py,sha256=iuVXOmWeCB1ZgLIpq_1QCtAvB7QL1NhPdx064NC2b50,7529
|
|
24
24
|
edri/api/handlers/html_handler.py,sha256=OprcTg1IQDI7eBK-_oHqA60P1H30LA9xIQpD7iV-Neg,7464
|
|
25
|
-
edri/api/handlers/http_handler.py,sha256=
|
|
25
|
+
edri/api/handlers/http_handler.py,sha256=Il16LpIMjSreUXohn4c2R79Bx9mKqz7a08LfTVvPwws,35567
|
|
26
26
|
edri/api/handlers/rest_handler.py,sha256=GAG5lVTsRMCf9IUmYb_pokxyPcOfbnKZ2p3jxfy_-Dw,3300
|
|
27
27
|
edri/api/handlers/websocket_handler.py,sha256=Dh2XannDuW0eFj5CEzf3owlGc1VTyQ8ehjpxYRrCYW8,8144
|
|
28
28
|
edri/api/static_pages/documentation.j2,sha256=Fe7KLsbqp9P-pQYqG2z8rbhhGVDDFf3m6SQ2mc3PFG4,8934
|
|
@@ -112,7 +112,7 @@ edri/utility/queue.py,sha256=xBbeu1DT3Krdxni0YABk7gDZ5fLQL9eX-H3U-1jSqag,3628
|
|
|
112
112
|
edri/utility/shared_memory_pipe.py,sha256=kmtd-1999s-cUVThxXVtw4N-rp_WgrHtl-h4hhEliXA,6396
|
|
113
113
|
edri/utility/storage.py,sha256=AbZwtj8py0OBy3dM5C0fJ97uV88TERZO79heEmyE9Yk,3781
|
|
114
114
|
edri/utility/transformation.py,sha256=4FeRNav-ifxuqgwq9ys3G5WtMzUAC3_2B3tnFhMENho,1450
|
|
115
|
-
edri/utility/validation.py,sha256=
|
|
115
|
+
edri/utility/validation.py,sha256=bLFgfBLc_nu8tK3-imS2pLdd_IOh-uR7CHjV_r6QodY,8225
|
|
116
116
|
edri/utility/watcher.py,sha256=9nwU-h6B_QCd02-z-2-Hvf6huro8B9yVcZAepoFtXQ4,4623
|
|
117
117
|
edri/utility/manager/__init__.py,sha256=bNyqET60wyq-QFmNwk52UKRweK5lYTDH_TF2UgS6enk,73
|
|
118
118
|
edri/utility/manager/scheduler.py,sha256=3wRPph-FGNrVMN3TG7SvZ_PDW8mNK7UdM3PnjI_QTH8,11624
|
|
@@ -156,7 +156,7 @@ tests/utility/test_validation.py,sha256=OEM9hGzlFoSvZdwf5_pyH-Xg9ISxw0QJFbgMaDP8
|
|
|
156
156
|
tests/utility/manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
157
157
|
tests/utility/manager/test_scheduler.py,sha256=sROffYvSOaWsYQxQGTy6l9Mn_qeNPRmJoXLVPKU3XNY,9153
|
|
158
158
|
tests/utility/manager/test_store.py,sha256=xlo1JUsPLIhPJyQn7AXldAgWDo_O8ba2ns25TEaaGdQ,2821
|
|
159
|
-
edri-2025.
|
|
160
|
-
edri-2025.
|
|
161
|
-
edri-2025.
|
|
162
|
-
edri-2025.
|
|
159
|
+
edri-2025.11.1rc2.dist-info/METADATA,sha256=Znv_9pH-YVrYGlhn9lN31KKpT-fSrrOkMj2sg4La034,8346
|
|
160
|
+
edri-2025.11.1rc2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
161
|
+
edri-2025.11.1rc2.dist-info/top_level.txt,sha256=himES6JgPlx4Zt8aDrQEj2fxAd7IDD6MBOsiNZkzKHQ,11
|
|
162
|
+
edri-2025.11.1rc2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|