python-sdk-remote 0.0.121__py3-none-any.whl → 0.0.122__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.
@@ -31,6 +31,38 @@ def get_query_string_parameters_from_event(event: dict) -> dict:
31
31
  return event.get("queryStringParameters") or {} # params sent with ?a=1&b=2
32
32
 
33
33
 
34
+ def get_request_parameters_from_event(event: dict) -> dict:
35
+ all_params = get_payload_dict_from_event(event)
36
+ all_params.update(get_path_parameters_dict_from_event(event))
37
+ all_params.update(get_query_string_parameters_from_event(event))
38
+ return all_params
39
+
40
+ # TODO: test
41
+ def handler_decorator(handler: callable, logger=logger):
42
+ """Decorator for AWS Lambda handler functions. It wraps the handler function with logging and error handling.
43
+ Usage:
44
+ from python_sdk_remote.http_response import handler_decorator
45
+ logger = ...
46
+ @handler_decorator(logger=logger)
47
+ def my_handler(request_parameters: dict) -> dict:
48
+ return {"message": "Hello, World!"}"""
49
+
50
+ def wrapper(event, context):
51
+ handler_response = None
52
+ try:
53
+ logger.start(object={"event": event, "context": context})
54
+ request_parameters = get_request_parameters_from_event(event)
55
+ body_result: dict = handler(request_parameters)
56
+ handler_response = create_ok_http_response(body_result)
57
+ except Exception as e:
58
+ handler_response = create_error_http_response(e)
59
+ finally:
60
+ logger.end(object={"handler_response": handler_response})
61
+ return handler_response
62
+
63
+ return wrapper
64
+
65
+
34
66
  def create_authorization_http_headers(user_jwt: str) -> dict:
35
67
  logger.start(object={"user_jwt": user_jwt})
36
68
  authorization_http_headers = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.121
3
+ Version: 0.0.122
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
6
6
  Author: Circles
@@ -1,6 +1,6 @@
1
1
  python_sdk_remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  python_sdk_remote/constants.py,sha256=9N_V1tNFsgBIbRV8SDy5cGCuhYBDkHn_gOxDnQV1ruE,1148
3
- python_sdk_remote/http_response.py,sha256=baY6TFX-uHod4fX1IHwJbaESY-mppx3K484WnUjoAW8,3530
3
+ python_sdk_remote/http_response.py,sha256=TFbXYje0ROBaBZf9QLndPSw1dlVjbTNr78s3byHTbdE,4801
4
4
  python_sdk_remote/item.py,sha256=HnSLHkZTKTLNhlaZoPhKAwqG-yHPsd7zvqPPOqnrKVg,287
5
5
  python_sdk_remote/mini_logger.py,sha256=E6OUZ39uBkPN_cjemO6hfJcRcYtP1xh1ZwaCFyZYsXA,4132
6
6
  python_sdk_remote/our_object.py,sha256=ASD_Pfk1mIqAuHDAsfsWpIhwhRvSwhhwSWRHZcfrGgU,2101
@@ -8,7 +8,7 @@ python_sdk_remote/unified_json.py,sha256=tLkikIVpFAtpioYwtovkGX8-3U9YElGWe4Ph34q
8
8
  python_sdk_remote/utilities.py,sha256=2ETzytISj9_Hcpic5tm_80H66WuxZu5YT7av7MA59Eg,14514
9
9
  python_sdk_remote/valid_json_versions.py,sha256=-ZU65JYI6gTEfK8o6gu9Dmm9SQmwzj5pDbEXiyUbBhQ,138
10
10
  python_sdk_remote/validate_environment.py,sha256=nzCHZDw56G56ekrTQT3gG48utjsU4VCwQi9dVsBDas0,2268
11
- python_sdk_remote-0.0.121.dist-info/METADATA,sha256=fzUoNy6pVB7K3_Py9ONDv9vPaksMPPgxU_XY3EjMQ0s,606
12
- python_sdk_remote-0.0.121.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- python_sdk_remote-0.0.121.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
14
- python_sdk_remote-0.0.121.dist-info/RECORD,,
11
+ python_sdk_remote-0.0.122.dist-info/METADATA,sha256=dLRTw__2vFyttQVrQxmO36e-EgO6S7Vnn5hyNqMDSuU,606
12
+ python_sdk_remote-0.0.122.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ python_sdk_remote-0.0.122.dist-info/top_level.txt,sha256=JTpEq_svPlI5hTlPq30Ne-NkR-u5464gjVDP2U74PvE,18
14
+ python_sdk_remote-0.0.122.dist-info/RECORD,,