kisa-utils 0.43.1__py3-none-any.whl → 0.43.2__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.
- kisa_utils/servers/flask.py +20 -8
- {kisa_utils-0.43.1.dist-info → kisa_utils-0.43.2.dist-info}/METADATA +1 -1
- {kisa_utils-0.43.1.dist-info → kisa_utils-0.43.2.dist-info}/RECORD +5 -5
- {kisa_utils-0.43.1.dist-info → kisa_utils-0.43.2.dist-info}/WHEEL +0 -0
- {kisa_utils-0.43.1.dist-info → kisa_utils-0.43.2.dist-info}/top_level.txt +0 -0
kisa_utils/servers/flask.py
CHANGED
|
@@ -26,7 +26,7 @@ import types
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
_VALID_HTTP_METHODS = {'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'}
|
|
29
|
-
_WHITE_LISTED_PARAMS = ["headers"]
|
|
29
|
+
_WHITE_LISTED_PARAMS = ["headers", 'requestHeaders', 'requestForm', 'requestJSON', 'requestOrigin']
|
|
30
30
|
|
|
31
31
|
from typing import Optional, Callable
|
|
32
32
|
from functools import wraps
|
|
@@ -537,8 +537,12 @@ def endpoint(
|
|
|
537
537
|
__DEFAULTS[key] = value.default
|
|
538
538
|
|
|
539
539
|
# print(typeHints)
|
|
540
|
-
|
|
541
|
-
|
|
540
|
+
for whiteListed in _WHITE_LISTED_PARAMS:
|
|
541
|
+
if whiteListed in typeHints:
|
|
542
|
+
del typeHints[whiteListed]
|
|
543
|
+
|
|
544
|
+
# if "headers" in typeHints and "headers" in _WHITE_LISTED_PARAMS:
|
|
545
|
+
# del typeHints["headers"]
|
|
542
546
|
|
|
543
547
|
validationStructure = copy.deepcopy(typeHints)
|
|
544
548
|
del validationStructure["return"]
|
|
@@ -587,15 +591,23 @@ def endpoint(
|
|
|
587
591
|
|
|
588
592
|
for item in kwargs:
|
|
589
593
|
kwarg = item[0]
|
|
590
|
-
|
|
594
|
+
|
|
595
|
+
if kwarg in _WHITE_LISTED_PARAMS:
|
|
596
|
+
_kwargs[kwarg] = {
|
|
597
|
+
"headers": request.headers,
|
|
598
|
+
"requestHeaders": request.headers,
|
|
599
|
+
"requestForm": request.form,
|
|
600
|
+
"requestJSON": request.json,
|
|
601
|
+
'requestOrigin': request.remote_addr,
|
|
602
|
+
}[kwarg]
|
|
603
|
+
|
|
604
|
+
if kwarg not in ['requestOrigin']:
|
|
605
|
+
_kwargs[kwarg] = dict(_kwargs[kwarg])
|
|
606
|
+
continue
|
|
591
607
|
|
|
592
608
|
if kwarg in payload:
|
|
593
609
|
_kwargs[kwarg] = payload[kwarg]
|
|
594
610
|
else:
|
|
595
|
-
if _headers_present and kwarg == "headers":
|
|
596
|
-
_kwargs[kwarg] = dict(request.headers)
|
|
597
|
-
continue
|
|
598
|
-
|
|
599
611
|
if len(item) == 2:
|
|
600
612
|
default = item[1]
|
|
601
613
|
_kwargs[kwarg] = default
|
|
@@ -24,11 +24,11 @@ kisa_utils/queues/callables/__init__.py,sha256=OJL3AQnaAS1Eek4H6WBH3WefA2wf-x03c
|
|
|
24
24
|
kisa_utils/queues/callables/enqueueFunctionCalls.py,sha256=VIliaMvw4MUdOqts0dXdZCYNxs-QrOVjIRAR3scGrRM,11786
|
|
25
25
|
kisa_utils/queues/callables/executorQueues.py,sha256=x6bAqxBSZRZ_kL8CK1lSN6JYAYFLxzM84LC1RmwaOLw,6626
|
|
26
26
|
kisa_utils/servers/__init__.py,sha256=lPqDyGTrFo0qwPZ2WA9Xtcpc5D8AIU4huqgFx1iZf68,19
|
|
27
|
-
kisa_utils/servers/flask.py,sha256=
|
|
27
|
+
kisa_utils/servers/flask.py,sha256=fjtWCJOkA9rbKv-tAJDcc6GDymGWDe7hL3TYJZUER10,40918
|
|
28
28
|
kisa_utils/structures/__init__.py,sha256=JBU1j3A42jQ62ALKnsS1Hav9YXcYwjDw1wQJtohXPbU,83
|
|
29
29
|
kisa_utils/structures/utils.py,sha256=665rXIapGwFqejizeJwy3DryeskCQOdgP25BCdLkGvk,2898
|
|
30
30
|
kisa_utils/structures/validator.py,sha256=oCSgY_itst6bZdC5g8yVU4-lSH2xnUsOx3X-oPyV7nA,4626
|
|
31
|
-
kisa_utils-0.43.
|
|
32
|
-
kisa_utils-0.43.
|
|
33
|
-
kisa_utils-0.43.
|
|
34
|
-
kisa_utils-0.43.
|
|
31
|
+
kisa_utils-0.43.2.dist-info/METADATA,sha256=tbGoEe4EqF1uwX1HE6VZb9lOAICb_91GaukrK-1qFFE,477
|
|
32
|
+
kisa_utils-0.43.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
33
|
+
kisa_utils-0.43.2.dist-info/top_level.txt,sha256=GFOLXZYqpBG9xtscGa2uGJAEiZ5NwsqHBH9NylnB29M,11
|
|
34
|
+
kisa_utils-0.43.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|