python-sdk-remote 0.0.142__tar.gz → 0.0.144__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.142 → python_sdk_remote-0.0.144}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/http_response.py +7 -3
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/mini_logger.py +1 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/our_object.py +8 -4
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/unified_json.py +6 -3
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/utilities.py +31 -15
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/setup.py +1 -1
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/README.md +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/is_test_data.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/setup.cfg +0 -0
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/http_response.py
RENAMED
|
@@ -19,18 +19,22 @@ AUTHORIZATION_PREFIX = 'Bearer '
|
|
|
19
19
|
# TODO Shall we add the word body? i.e. get_body_payload_idct_from_event()
|
|
20
20
|
def get_payload_dict_from_event(event: dict) -> dict:
|
|
21
21
|
"""Extracts params sent with payload"""
|
|
22
|
-
|
|
22
|
+
get_payload_dict_from_event_result = to_dict(event.get('body'))
|
|
23
|
+
return get_payload_dict_from_event_result
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def get_path_parameters_dict_from_event(event: dict) -> dict:
|
|
26
27
|
"""Extracts params sent implicitly: `url/param?test=5` -> param
|
|
27
28
|
(when the path is defined with /{param})"""
|
|
28
|
-
|
|
29
|
+
get_path_parameters_dict_from_event_result = event.get("pathParameters") or {}
|
|
30
|
+
return get_path_parameters_dict_from_event_result
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
def get_query_string_parameters_from_event(event: dict) -> dict:
|
|
32
34
|
"""Extracts params sent explicitly: `url/test?a=1&b=2` -> {'a': '1', 'b': '2'}"""
|
|
33
|
-
|
|
35
|
+
# params sent with ?a=1&b=2
|
|
36
|
+
get_query_string_parameters_from_event_result = event.get("queryStringParameters") or {}
|
|
37
|
+
return get_query_string_parameters_from_event_result
|
|
34
38
|
|
|
35
39
|
|
|
36
40
|
def get_request_parameters_from_event(event: dict) -> dict:
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/mini_logger.py
RENAMED
|
@@ -90,6 +90,7 @@ class MiniLogger:
|
|
|
90
90
|
message (str): The message to be printed.
|
|
91
91
|
object (dict): The object to be printed.
|
|
92
92
|
"""
|
|
93
|
+
# TODO Add the source of the message - We should add the object or atleast some parts of it
|
|
93
94
|
if object is None:
|
|
94
95
|
logger.warning(f"WARNING - {message}")
|
|
95
96
|
else:
|
|
@@ -73,7 +73,8 @@ class OurObject(ABC):
|
|
|
73
73
|
|
|
74
74
|
def get_all_arguments(self):
|
|
75
75
|
"""Returns all the arguments passed to the constructor as a dictionary"""
|
|
76
|
-
|
|
76
|
+
get_all_arguments_result = getattr(self, 'kwargs', None)
|
|
77
|
+
return get_all_arguments_result
|
|
77
78
|
|
|
78
79
|
def to_json(self) -> str:
|
|
79
80
|
"""Returns a json string representation of this object"""
|
|
@@ -94,14 +95,17 @@ class OurObject(ABC):
|
|
|
94
95
|
"""Checks if two objects are equal"""
|
|
95
96
|
if not isinstance(other, OurObject):
|
|
96
97
|
return False
|
|
97
|
-
|
|
98
|
+
eq_result = self.__dict__ == other.__dict__
|
|
99
|
+
return eq_result
|
|
98
100
|
|
|
99
101
|
def __ne__(self, other) -> bool:
|
|
100
102
|
"""Checks if two objects are not equal"""
|
|
101
|
-
|
|
103
|
+
ne_result = not self.__eq__(other)
|
|
104
|
+
return ne_result
|
|
102
105
|
|
|
103
106
|
def __str__(self):
|
|
104
|
-
|
|
107
|
+
str_result = self.entity_name + ": " + str(self.__dict__)
|
|
108
|
+
return str_result
|
|
105
109
|
|
|
106
110
|
def __repr__(self):
|
|
107
111
|
# TODO make sure both of them is not None
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/unified_json.py
RENAMED
|
@@ -13,7 +13,8 @@ class UnifiedJson:
|
|
|
13
13
|
self.data = data
|
|
14
14
|
|
|
15
15
|
def get_unified_json(self):
|
|
16
|
-
|
|
16
|
+
get_unified_json_result = {"version": self.json_version, "data": self.data}
|
|
17
|
+
return get_unified_json_result
|
|
17
18
|
|
|
18
19
|
def get_data(self):
|
|
19
20
|
return self.data
|
|
@@ -22,7 +23,9 @@ class UnifiedJson:
|
|
|
22
23
|
return self.json_version
|
|
23
24
|
|
|
24
25
|
def __str__(self):
|
|
25
|
-
|
|
26
|
+
str_result = self.get_unified_json()
|
|
27
|
+
return str_result
|
|
26
28
|
|
|
27
29
|
def __repr__(self):
|
|
28
|
-
|
|
30
|
+
repr_result = self.__str__()
|
|
31
|
+
return repr_result
|
|
@@ -39,17 +39,20 @@ def append_if_not_exist(lst: list, item: object) -> None:
|
|
|
39
39
|
|
|
40
40
|
def to_dict(data: json or dict or None) -> dict:
|
|
41
41
|
if data is None:
|
|
42
|
-
|
|
42
|
+
to_dict_result = {}
|
|
43
|
+
return to_dict_result
|
|
43
44
|
if isinstance(data, dict):
|
|
44
45
|
return data
|
|
45
|
-
|
|
46
|
+
to_dict_result = json.loads(data)
|
|
47
|
+
return to_dict_result
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
def to_json(data: json or dict or None) -> json:
|
|
49
51
|
if data is None:
|
|
50
52
|
data = {}
|
|
51
53
|
if isinstance(data, dict):
|
|
52
|
-
|
|
54
|
+
to_json_result = json.dumps(data)
|
|
55
|
+
return to_json_result
|
|
53
56
|
return data
|
|
54
57
|
|
|
55
58
|
|
|
@@ -277,7 +280,8 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (dat
|
|
|
277
280
|
|
|
278
281
|
|
|
279
282
|
def get_brand_name() -> str:
|
|
280
|
-
|
|
283
|
+
get_brand_name_result = our_get_env("BRAND_NAME")
|
|
284
|
+
return get_brand_name_result
|
|
281
285
|
|
|
282
286
|
|
|
283
287
|
def get_environment_name() -> str:
|
|
@@ -300,19 +304,24 @@ def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True,
|
|
|
300
304
|
|
|
301
305
|
# TODO As only the database package uses those, let's move those three to the database package
|
|
302
306
|
def get_sql_hostname() -> str:
|
|
303
|
-
|
|
307
|
+
get_sql_hostname_result = our_get_env("RDS_HOSTNAME")
|
|
308
|
+
return get_sql_hostname_result
|
|
304
309
|
|
|
305
310
|
|
|
306
311
|
def get_sql_username() -> str:
|
|
307
|
-
|
|
312
|
+
get_sql_username_result = our_get_env("RDS_USERNAME")
|
|
313
|
+
return get_sql_username_result
|
|
308
314
|
|
|
309
315
|
|
|
310
316
|
def get_sql_password() -> str:
|
|
311
|
-
|
|
317
|
+
get_sql_password_result = our_get_env("RDS_PASSWORD")
|
|
318
|
+
return get_sql_password_result
|
|
312
319
|
|
|
313
320
|
|
|
321
|
+
# TODO Shall we move this to dialog repo?
|
|
314
322
|
def get_dialog_jwt_secret_key() -> str:
|
|
315
|
-
|
|
323
|
+
get_dialog_jwt_secret_key_result = our_get_env("DIALOG_JWT_SECRET_KEY", raise_if_empty=True)
|
|
324
|
+
return get_dialog_jwt_secret_key_result
|
|
316
325
|
|
|
317
326
|
|
|
318
327
|
def encode_jwt(payload: dict, key: str) -> str:
|
|
@@ -323,12 +332,14 @@ def encode_jwt(payload: dict, key: str) -> str:
|
|
|
323
332
|
"exp": datetime.datetime.utcnow() + datetime.timedelta(hours=1)
|
|
324
333
|
}
|
|
325
334
|
"""
|
|
326
|
-
|
|
335
|
+
encode_jwt_result = jwt.encode(payload, key, algorithm='HS256')
|
|
336
|
+
return encode_jwt_result
|
|
327
337
|
|
|
328
338
|
|
|
329
339
|
def decode_jwt(token: str, key: str) -> dict:
|
|
330
340
|
"""key can be private / public"""
|
|
331
|
-
|
|
341
|
+
decode_jwt_result = jwt.decode(token, key, algorithms=['HS256'])
|
|
342
|
+
return decode_jwt_result
|
|
332
343
|
|
|
333
344
|
|
|
334
345
|
def obfuscate_log_dict(log_dict: dict) -> dict:
|
|
@@ -362,7 +373,8 @@ def obfuscate_log_dict(log_dict: dict) -> dict:
|
|
|
362
373
|
# TODO: add tests to the following functions
|
|
363
374
|
|
|
364
375
|
def remove_digits(text: str) -> str:
|
|
365
|
-
|
|
376
|
+
remove_digits_result = ''.join(i for i in text if not i.isdigit())
|
|
377
|
+
return remove_digits_result
|
|
366
378
|
|
|
367
379
|
|
|
368
380
|
def generate_otp():
|
|
@@ -377,11 +389,13 @@ def get_current_datetime_string(datetime_format: str = DEFAULT_DATETIME_FORMAT,
|
|
|
377
389
|
|
|
378
390
|
|
|
379
391
|
def datetime_from_str(date_str: str, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> datetime:
|
|
380
|
-
|
|
392
|
+
datetime_from_str_result = datetime.strptime(date_str, datetime_format)
|
|
393
|
+
return datetime_from_str_result
|
|
381
394
|
|
|
382
395
|
|
|
383
396
|
def datetime_to_str(input_datetime: datetime, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> str:
|
|
384
|
-
|
|
397
|
+
datetime_to_str_result = input_datetime.strftime(datetime_format)
|
|
398
|
+
return datetime_to_str_result
|
|
385
399
|
|
|
386
400
|
|
|
387
401
|
def validate_arguments(args: dict) -> None:
|
|
@@ -409,11 +423,13 @@ def reformat_time_string(input_str: str) -> str:
|
|
|
409
423
|
|
|
410
424
|
|
|
411
425
|
def get_ip_v4():
|
|
412
|
-
|
|
426
|
+
get_ip_v4_result = requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
|
|
427
|
+
return get_ip_v4_result
|
|
413
428
|
|
|
414
429
|
|
|
415
430
|
def get_ip_v6():
|
|
416
|
-
|
|
431
|
+
get_ip_v6_result = requests.get('https://api.seeip.org/jsonip').json()['ip']
|
|
432
|
+
return get_ip_v6_result
|
|
417
433
|
|
|
418
434
|
|
|
419
435
|
def snake_to_camel(snake_str: str) -> str:
|
|
@@ -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.144', # 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.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/is_test_data.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.142 → python_sdk_remote-0.0.144}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|