python-sdk-remote 0.0.85__tar.gz → 0.0.87__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.
Potentially problematic release.
This version of python-sdk-remote might be problematic. Click here for more details.
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/PKG-INFO +1 -1
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/mini_logger.py +5 -2
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/utilities.py +19 -13
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/setup.py +1 -1
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/README.md +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/pyproject.toml +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/__init__.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/constants.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/item.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/our_object.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/unified_json.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/validate_environment.py +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/setup.cfg +0 -0
|
@@ -4,17 +4,20 @@ import sys
|
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
|
|
6
6
|
LOGGER_MINIMUM_SEVERITY = os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO").upper()
|
|
7
|
+
# logging expects NOTSET/DEBUG/INFO/WARNING/ERROR/FATAL/CRITICAL
|
|
7
8
|
if LOGGER_MINIMUM_SEVERITY.isdigit():
|
|
8
9
|
logger_minimum_severity = int(LOGGER_MINIMUM_SEVERITY)
|
|
9
10
|
# Values from Logger.MessageSeverity
|
|
10
|
-
if logger_minimum_severity <
|
|
11
|
+
if logger_minimum_severity < 400:
|
|
12
|
+
LOGGER_MINIMUM_SEVERITY = "DEBUG"
|
|
13
|
+
elif logger_minimum_severity < 600:
|
|
11
14
|
LOGGER_MINIMUM_SEVERITY = "INFO"
|
|
12
15
|
elif logger_minimum_severity < 700:
|
|
13
16
|
LOGGER_MINIMUM_SEVERITY = "WARNING"
|
|
14
17
|
elif logger_minimum_severity < 800:
|
|
15
18
|
LOGGER_MINIMUM_SEVERITY = "ERROR"
|
|
16
19
|
else:
|
|
17
|
-
LOGGER_MINIMUM_SEVERITY = "
|
|
20
|
+
LOGGER_MINIMUM_SEVERITY = "CRITICAL"
|
|
18
21
|
|
|
19
22
|
logging.basicConfig(level=LOGGER_MINIMUM_SEVERITY, stream=sys.stdout,
|
|
20
23
|
format="%(asctime)s - %(message)s")
|
|
@@ -74,7 +74,7 @@ def is_valid_time_range(time_range: tuple) -> bool:
|
|
|
74
74
|
return True
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def validate_url(url):
|
|
77
|
+
def validate_url(url: str):
|
|
78
78
|
if url is not None or url != "":
|
|
79
79
|
parsed_url = urlparse(url)
|
|
80
80
|
return parsed_url.scheme and parsed_url.netloc
|
|
@@ -125,7 +125,7 @@ def is_valid_datetime_range(datetime_range: tuple) -> bool:
|
|
|
125
125
|
return True
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
def is_list_of_dicts(obj):
|
|
128
|
+
def is_list_of_dicts(obj: object) -> bool:
|
|
129
129
|
"""
|
|
130
130
|
Check if an object is a list of dictionaries.
|
|
131
131
|
|
|
@@ -138,14 +138,13 @@ def is_list_of_dicts(obj):
|
|
|
138
138
|
Example:
|
|
139
139
|
Usage of is_list_of_dicts:
|
|
140
140
|
|
|
141
|
-
>>>
|
|
142
|
-
>>> result = is_list_of_dicts(data)
|
|
143
|
-
>>> print(result)
|
|
141
|
+
>>> is_list_of_dicts([{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}])
|
|
144
142
|
True
|
|
145
143
|
|
|
146
|
-
>>>
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
>>> is_list_of_dicts([1, 2, 3])
|
|
145
|
+
False
|
|
146
|
+
|
|
147
|
+
>>> is_list_of_dicts(1)
|
|
149
148
|
False
|
|
150
149
|
"""
|
|
151
150
|
IS_LIST_OF_DICTS_FUNCTION_NAME = "is_list_of_dicts"
|
|
@@ -251,7 +250,7 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: tupl
|
|
|
251
250
|
# TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
|
|
252
251
|
|
|
253
252
|
# Former name was create_http_headers()
|
|
254
|
-
def create_authorization_http_headers(user_jwt: str):
|
|
253
|
+
def create_authorization_http_headers(user_jwt: str) -> dict:
|
|
255
254
|
http_headers = {
|
|
256
255
|
'Content-Type': 'application/json',
|
|
257
256
|
'Authorization': f'Bearer {user_jwt}',
|
|
@@ -259,7 +258,14 @@ def create_authorization_http_headers(user_jwt: str):
|
|
|
259
258
|
return http_headers
|
|
260
259
|
|
|
261
260
|
|
|
262
|
-
def
|
|
261
|
+
def get_jwt_from_event(event: dict) -> str:
|
|
262
|
+
auth_header = event.get('headers', {}).get('authorization')
|
|
263
|
+
if auth_header is None:
|
|
264
|
+
auth_header = event.get('headers', {}).get('Authorization')
|
|
265
|
+
return auth_header.split('Bearer ')[1]
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def create_return_http_headers() -> dict:
|
|
263
269
|
return {
|
|
264
270
|
"Content-Type": "application/json",
|
|
265
271
|
"Access-Control-Allow-Origin": "*",
|
|
@@ -267,17 +273,17 @@ def create_return_http_headers():
|
|
|
267
273
|
|
|
268
274
|
|
|
269
275
|
# https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format
|
|
270
|
-
def create_http_body(body):
|
|
276
|
+
def create_http_body(body: dict) -> str:
|
|
271
277
|
# TODO console.warning() if the body is not a valid camelCase JSON
|
|
272
278
|
# https://stackoverflow.com/questions/17156078/converting-identifier-naming-between-camelcase-and-underscores-during-json-seria
|
|
273
279
|
return json.dumps(body)
|
|
274
280
|
|
|
275
281
|
|
|
276
|
-
def get_brand_name():
|
|
282
|
+
def get_brand_name() -> str:
|
|
277
283
|
return our_get_env("BRAND_NAME")
|
|
278
284
|
|
|
279
285
|
|
|
280
|
-
def get_environment_name():
|
|
286
|
+
def get_environment_name() -> str:
|
|
281
287
|
environment_name = our_get_env("ENVIRONMENT_NAME")
|
|
282
288
|
EnvironmentName(environment_name) # if invalid, raises ValueError: x is not a valid EnvironmentName
|
|
283
289
|
return environment_name
|
|
@@ -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.87', # https://pypi.org/project/python-sdk-remote/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circles.life",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
{python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote/src/validate_environment.py
RENAMED
|
File without changes
|
{python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python-sdk-remote-0.0.85 → python-sdk-remote-0.0.87}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|