python-sdk-local 0.0.134__tar.gz → 0.0.135__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.
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/PKG-INFO +2 -2
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/http_response.py +12 -8
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/PKG-INFO +2 -2
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/requires.txt +1 -1
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/setup.py +3 -2
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/README.md +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/pyproject.toml +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/__init__.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/constants.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/item.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/our_object.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/unified_json.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/utilities.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/valid_json_versions.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/validate_environment.py +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/SOURCES.txt +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/dependency_links.txt +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/top_level.txt +0 -0
- {python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.135
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -13,6 +13,6 @@ Requires-Dist: requests
|
|
|
13
13
|
Requires-Dist: python-dotenv
|
|
14
14
|
Requires-Dist: url-remote
|
|
15
15
|
Requires-Dist: pyjwt
|
|
16
|
-
Requires-Dist: python-sdk-remote
|
|
16
|
+
Requires-Dist: python-sdk-remoteuser-context-remote
|
|
17
17
|
|
|
18
18
|
This is a package for sharing common functions used in different repositories
|
|
@@ -4,6 +4,8 @@ from http import HTTPStatus
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
6
|
from python_sdk_remote.mini_logger import MiniLogger as logger
|
|
7
|
+
from user_context_remote.user_context import UserContext
|
|
8
|
+
|
|
7
9
|
from .utilities import camel_to_snake, snake_to_camel, to_dict, to_json
|
|
8
10
|
|
|
9
11
|
HEADERS_KEY = 'headers'
|
|
@@ -43,10 +45,10 @@ def get_request_parameters_from_event(event: dict) -> dict:
|
|
|
43
45
|
all_parameters_dict.update({snake_to_camel(key): value for key, value in all_parameters_dict.items()})
|
|
44
46
|
return all_parameters_dict
|
|
45
47
|
|
|
48
|
+
|
|
46
49
|
# TODO: move everything related to serverless to another file
|
|
47
50
|
# TODO: test
|
|
48
|
-
|
|
49
|
-
def handler_decorator(logger, user_context = None):
|
|
51
|
+
def handler_decorator(logger):
|
|
50
52
|
"""Decorator for AWS Lambda handler functions. It wraps the handler function with logging and error handling.
|
|
51
53
|
Usage:
|
|
52
54
|
from python_sdk_local.http_response import handler_decorator
|
|
@@ -61,10 +63,12 @@ def handler_decorator(logger, user_context = None):
|
|
|
61
63
|
handler_response = None
|
|
62
64
|
try:
|
|
63
65
|
logger.start(object={"event": event, "context": context})
|
|
64
|
-
if user_context:
|
|
65
|
-
user_jwt = get_user_jwt_from_event(event)
|
|
66
|
-
user_context.login_using_user_jwt(user_jwt)
|
|
67
66
|
request_parameters = get_request_parameters_from_event(event)
|
|
67
|
+
user_jwt = get_user_jwt_from_event(event)
|
|
68
|
+
if user_jwt:
|
|
69
|
+
request_parameters["user_context"] = UserContext.login_using_user_jwt(user_jwt)
|
|
70
|
+
else:
|
|
71
|
+
logger.warning("No user_jwt provided")
|
|
68
72
|
body_result = handler(request_parameters)
|
|
69
73
|
handler_response = create_ok_http_response(body_result)
|
|
70
74
|
except Exception as e:
|
|
@@ -91,10 +95,10 @@ def create_authorization_http_headers(user_jwt: str) -> dict:
|
|
|
91
95
|
|
|
92
96
|
def get_user_jwt_from_event(event: dict) -> str:
|
|
93
97
|
logger.start(object={"event": event})
|
|
94
|
-
auth_header = event.get(HEADERS_KEY, {}).get(AUTHORIZATION_KEY)
|
|
98
|
+
auth_header = event.get(HEADERS_KEY, {}).get(AUTHORIZATION_KEY, "")
|
|
95
99
|
if auth_header is None:
|
|
96
|
-
auth_header = event.get(HEADERS_KEY, {}).get(AUTHORIZATION_KEY.lower())
|
|
97
|
-
user_jwt = auth_header.split(AUTHORIZATION_PREFIX)[1]
|
|
100
|
+
auth_header = event.get(HEADERS_KEY, {}).get(AUTHORIZATION_KEY.lower(), "")
|
|
101
|
+
user_jwt = auth_header.split(AUTHORIZATION_PREFIX)[-1]
|
|
98
102
|
logger.end(object={"user_jwt": user_jwt})
|
|
99
103
|
return user_jwt
|
|
100
104
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.135
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -13,6 +13,6 @@ Requires-Dist: requests
|
|
|
13
13
|
Requires-Dist: python-dotenv
|
|
14
14
|
Requires-Dist: url-remote
|
|
15
15
|
Requires-Dist: pyjwt
|
|
16
|
-
Requires-Dist: python-sdk-remote
|
|
16
|
+
Requires-Dist: python-sdk-remoteuser-context-remote
|
|
17
17
|
|
|
18
18
|
This is a package for sharing common functions used in different repositories
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import setuptools
|
|
1
|
+
import setuptools
|
|
2
2
|
|
|
3
3
|
PACKAGE_NAME = "python-sdk-local"
|
|
4
4
|
package_dir = PACKAGE_NAME.replace("-", "_")
|
|
@@ -7,7 +7,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
7
7
|
# python -m build needs pyproject.toml or setup.py
|
|
8
8
|
setuptools.setup(
|
|
9
9
|
name=PACKAGE_NAME,
|
|
10
|
-
version='0.0.
|
|
10
|
+
version='0.0.135', # https://pypi.org/project/python-sdk-local/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circlez.ai",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
@@ -28,5 +28,6 @@ setuptools.setup(
|
|
|
28
28
|
"url-remote",
|
|
29
29
|
"pyjwt",
|
|
30
30
|
"python-sdk-remote"
|
|
31
|
+
"user-context-remote",
|
|
31
32
|
]
|
|
32
33
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/valid_json_versions.py
RENAMED
|
File without changes
|
{python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local/src/validate_environment.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_sdk_local-0.0.134 → python_sdk_local-0.0.135}/python_sdk_local.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|