python-sdk-remote 0.0.145__tar.gz → 0.0.147__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.145 → python_sdk_remote-0.0.147}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/http_response.py +2 -2
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/mini_logger.py +10 -2
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/utilities.py +24 -13
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/setup.py +1 -1
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/README.md +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/is_test_data.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/our_object.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/setup.cfg +0 -0
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/http_response.py
RENAMED
|
@@ -11,7 +11,7 @@ AUTHORIZATION_KEY = 'authorization'
|
|
|
11
11
|
AUTHORIZATION_PREFIX = 'Bearer '
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# TODO Align those methods with typescript-sdk https://github.com/circles-zone/typescript-sdk-remote-typescript-package/blob/dev/typescript-sdk/src/utils/index.ts
|
|
14
|
+
# TODO Align those methods with typescript-sdk https://github.com/circles-zone/typescript-sdk-remote-typescript-package/blob/dev/typescript-sdk/src/utils/index.ts # noqa: E501
|
|
15
15
|
# TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
|
|
16
16
|
|
|
17
17
|
# TODO: add handler wrapper?
|
|
@@ -104,7 +104,7 @@ def get_user_jwt_from_event(event: dict) -> str:
|
|
|
104
104
|
def create_return_http_headers() -> dict:
|
|
105
105
|
logger.start()
|
|
106
106
|
# Adding "Access-Control-Allow-Origin" : "*" to take care of CORS from localhost
|
|
107
|
-
# TODO Do we need to add those? In which cases? try adding crossDomain: true, to the request, 'Access-Control-Allow-Credentials': true to header
|
|
107
|
+
# TODO Do we need to add those? In which cases? try adding crossDomain: true, to the request, 'Access-Control-Allow-Credentials': true to header # noqa: E501
|
|
108
108
|
return_http_headers = {
|
|
109
109
|
"Content-Type": "application/json",
|
|
110
110
|
"Access-Control-Allow-Origin": "*",
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/mini_logger.py
RENAMED
|
@@ -2,12 +2,16 @@ import logging
|
|
|
2
2
|
import os
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
|
+
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT
|
|
5
6
|
LOGGER_MINIMUM_SEVERITY = os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO").upper()
|
|
6
7
|
# logging expects NOTSET/DEBUG/INFO/WARNING/ERROR/FATAL/CRITICAL
|
|
7
8
|
if LOGGER_MINIMUM_SEVERITY.isdigit():
|
|
9
|
+
# TODO logger_minimal_severity_default_value
|
|
8
10
|
logger_minimum_severity = int(LOGGER_MINIMUM_SEVERITY)
|
|
9
|
-
#
|
|
11
|
+
# TODO Change Magic Numbers and use the values from Logger.MessageSeverity
|
|
10
12
|
if logger_minimum_severity < 400:
|
|
13
|
+
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT_NAME =
|
|
14
|
+
# TODO Change "DEBUG", "INFO", "WARNING" ... into enum values from Logger.MessageSeverity
|
|
11
15
|
LOGGER_MINIMUM_SEVERITY = "DEBUG"
|
|
12
16
|
elif logger_minimum_severity < 600:
|
|
13
17
|
LOGGER_MINIMUM_SEVERITY = "INFO"
|
|
@@ -24,7 +28,9 @@ logger = logging.getLogger(__name__)
|
|
|
24
28
|
|
|
25
29
|
|
|
26
30
|
class MiniLogger:
|
|
27
|
-
# TODO Can we
|
|
31
|
+
# TODO Can we have one generic function called by all as we have a lot of duplicated code here?
|
|
32
|
+
|
|
33
|
+
# TODO: print the caller function name
|
|
28
34
|
|
|
29
35
|
@staticmethod
|
|
30
36
|
def start(message: str = "", object: dict = None):
|
|
@@ -53,6 +59,8 @@ class MiniLogger:
|
|
|
53
59
|
else:
|
|
54
60
|
logger.debug(f"END - {message} - {object}")
|
|
55
61
|
|
|
62
|
+
# TODO convert all those methods (debug, info, warning, error) into one unified private method
|
|
63
|
+
# TODO Add to the unified private method print of the name of method, version and line number of the calling function/method to the mini_logger methods # noqa: E501
|
|
56
64
|
@staticmethod
|
|
57
65
|
def debug(message: str = "", object: dict = None):
|
|
58
66
|
"""
|
|
@@ -279,42 +279,53 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (dat
|
|
|
279
279
|
return is_datetime_in_datetime_range_result
|
|
280
280
|
|
|
281
281
|
|
|
282
|
-
def get_brand_name(
|
|
283
|
-
|
|
282
|
+
def get_brand_name(raise_if_not_found: bool = True,
|
|
283
|
+
raise_if_empty: bool = False) -> str:
|
|
284
|
+
get_brand_name_result = our_get_env("BRAND_NAME",
|
|
285
|
+
raise_if_not_found=raise_if_not_found,
|
|
286
|
+
raise_if_empty=raise_if_empty)
|
|
284
287
|
return get_brand_name_result
|
|
285
288
|
|
|
286
289
|
|
|
287
|
-
def get_environment_name(
|
|
288
|
-
|
|
290
|
+
def get_environment_name(raise_if_not_found: bool = True,
|
|
291
|
+
raise_if_empty: bool = False) -> str:
|
|
292
|
+
environment_name = our_get_env("ENVIRONMENT_NAME",
|
|
293
|
+
raise_if_not_found=raise_if_not_found,
|
|
294
|
+
raise_if_empty=raise_if_empty)
|
|
289
295
|
EnvironmentName(environment_name) # if invalid, raises ValueError: x is not a valid EnvironmentName
|
|
290
296
|
return environment_name
|
|
291
297
|
|
|
292
298
|
|
|
293
299
|
def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True,
|
|
294
300
|
raise_if_empty: bool = False) -> str:
|
|
295
|
-
logger.start(object={"key": key, "default": default,
|
|
301
|
+
logger.start(object={"key": key, "default": default,
|
|
302
|
+
"raise_if_not_found": raise_if_not_found,
|
|
296
303
|
"raise_if_empty": raise_if_empty})
|
|
297
304
|
env_var = os.getenv(key, default)
|
|
305
|
+
# TODO: "default is None" is always False
|
|
298
306
|
if ((raise_if_not_found and key not in os.environ and default is None)
|
|
299
307
|
or (raise_if_empty and not env_var and not default)):
|
|
300
|
-
raise Exception(f"Environment variable {key} not found - please check your .env file")
|
|
308
|
+
raise Exception(f"Environment variable {key} not found - please check your .env file") # noqa: E501
|
|
301
309
|
logger.end(object={"env_var": env_var})
|
|
302
310
|
return env_var
|
|
303
311
|
|
|
304
312
|
|
|
305
|
-
# TODO As only the database package uses those, let's move those three to the database package
|
|
306
|
-
def get_sql_hostname() -> str:
|
|
307
|
-
get_sql_hostname_result = our_get_env("RDS_HOSTNAME"
|
|
313
|
+
# TODO As only the database package uses those, let's move those three to the database package # noqa: E501
|
|
314
|
+
def get_sql_hostname(raise_if_not_found: bool = True, raise_if_empty: bool = False) -> str:
|
|
315
|
+
get_sql_hostname_result = our_get_env("RDS_HOSTNAME",
|
|
316
|
+
raise_if_empty=raise_if_empty)
|
|
308
317
|
return get_sql_hostname_result
|
|
309
318
|
|
|
310
319
|
|
|
311
|
-
def get_sql_username() -> str:
|
|
312
|
-
get_sql_username_result = our_get_env("RDS_USERNAME"
|
|
320
|
+
def get_sql_username(raise_if_empty: bool = False) -> str:
|
|
321
|
+
get_sql_username_result = our_get_env("RDS_USERNAME",
|
|
322
|
+
raise_if_empty=raise_if_empty)
|
|
313
323
|
return get_sql_username_result
|
|
314
324
|
|
|
315
325
|
|
|
316
|
-
def get_sql_password() -> str:
|
|
317
|
-
get_sql_password_result = our_get_env("RDS_PASSWORD"
|
|
326
|
+
def get_sql_password(raise_if_empty: bool = False) -> str:
|
|
327
|
+
get_sql_password_result = our_get_env("RDS_PASSWORD",
|
|
328
|
+
raise_if_empty=raise_if_empty)
|
|
318
329
|
return get_sql_password_result
|
|
319
330
|
|
|
320
331
|
|
|
@@ -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.147', # https://pypi.org/project/python-sdk-remote/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circlez.ai",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/is_test_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.145 → python_sdk_remote-0.0.147}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|