kisa-utils 0.43.0__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/score.py CHANGED
@@ -48,7 +48,7 @@ def getNamesMatchScore(namesA:str, namesB:str, /) -> float:
48
48
  for permutationA in __getPermutations(namesListA, itemsPerResult=leastNameCount):
49
49
  for permutationB in __getPermutations(namesListB, itemsPerResult=leastNameCount):
50
50
  if (_score := difflib.SequenceMatcher(None, permutationA, permutationB).ratio()*100) > score:
51
- print(f' {permutationA}, {permutationB}')
51
+ # print(f' {permutationA}, {permutationB}')
52
52
  score = _score
53
53
  if 100.0 == score: return score
54
54
 
@@ -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
- if "headers" in typeHints and "headers" in _WHITE_LISTED_PARAMS:
541
- del typeHints["headers"]
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
- _headers_present = True if kwarg == "headers" else False
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisa-utils
3
- Version: 0.43.0
3
+ Version: 0.43.2
4
4
  Summary: Utility functions and modules for KISA Developers
5
5
  Author: Tom Bukenya
6
6
  Author-email: glayn2bukman@gmail.com
@@ -11,7 +11,7 @@ kisa_utils/functionUtils.py,sha256=PlXjnmU1uJWNdISlJJ3SCgavTsgNBoebaa9dtWSFhRA,6
11
11
  kisa_utils/log.py,sha256=0TYdxcIBts026RCSuVIQBcZ-CW1ES7n3M1nEIjmeLTM,2295
12
12
  kisa_utils/remote.py,sha256=z5QTKC0Mb_wMWVHWfUHR1XOOek-A2fNjo1GyFPhAB8s,2373
13
13
  kisa_utils/response.py,sha256=asETUBkeF5OlSTwa-coa7lZDCKmQlHCmHf6eaZFl8CU,4560
14
- kisa_utils/score.py,sha256=sulT7dvBoE_6upvbfjfWCMoC5Fn4wBhRU3aG5_uNFvE,2003
14
+ kisa_utils/score.py,sha256=li4NG6sZlzbcXrnxrZZRamiyvRtlKxt5ZJ46QER6BiQ,2005
15
15
  kisa_utils/standardize.py,sha256=nt-uzHQFoKxGscD_MpDYXw65Teg3724whAqa6Kh_zhE,2231
16
16
  kisa_utils/storage.py,sha256=6NdEVrHMS7WB_vmCwiGigIinu-EjxalFJhk1kj-_vWs,5990
17
17
  kisa_utils/threads.py,sha256=PstMHimkOABXlYmKJi5SHcevzm1JuFGNZSlF0bGzuGk,13137
@@ -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=XZYY1pWnP1mSvaS5Uv8G3EFJV5BJBQtU2gDbO8suvLc,40422
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.0.dist-info/METADATA,sha256=uf_VNnKZPbGRL-tBOhaOf2LN14-akvvmuIppr99dYuQ,477
32
- kisa_utils-0.43.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
33
- kisa_utils-0.43.0.dist-info/top_level.txt,sha256=GFOLXZYqpBG9xtscGa2uGJAEiZ5NwsqHBH9NylnB29M,11
34
- kisa_utils-0.43.0.dist-info/RECORD,,
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,,