python-sdk-remote 0.0.128__tar.gz → 0.0.129__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.128 → python_sdk_remote-0.0.129}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/http_response.py +4 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/item.py +3 -1
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/our_object.py +3 -0
- python_sdk_remote-0.0.129/python_sdk_remote/src/temp.py +15 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/unified_json.py +3 -1
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/utilities.py +24 -10
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/SOURCES.txt +1 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/setup.py +1 -1
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/README.md +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/mini_logger.py +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/setup.cfg +0 -0
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/http_response.py
RENAMED
|
@@ -4,18 +4,22 @@ from http import HTTPStatus
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
6
|
from .mini_logger import MiniLogger as logger
|
|
7
|
+
from datetime import date
|
|
8
|
+
from . import temp
|
|
7
9
|
from .utilities import camel_to_snake, snake_to_camel, to_dict, to_json
|
|
8
10
|
|
|
9
11
|
HEADERS_KEY = 'headers'
|
|
10
12
|
AUTHORIZATION_KEY = 'authorization'
|
|
11
13
|
AUTHORIZATION_PREFIX = 'Bearer '
|
|
12
14
|
|
|
15
|
+
temp.deprecation_warning("http_response","DELETE",date(2024,7,25))
|
|
13
16
|
|
|
14
17
|
# 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
|
|
15
18
|
# TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
|
|
16
19
|
|
|
17
20
|
# TODO: add handler wrapper?
|
|
18
21
|
|
|
22
|
+
#TODO Shall we add the word body? i.e. get_body_payload_idct_from_event()
|
|
19
23
|
def get_payload_dict_from_event(event: dict) -> dict:
|
|
20
24
|
"""Extracts params sent with payload"""
|
|
21
25
|
return to_dict(event.get('body'))
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
2
|
|
|
3
3
|
from .our_object import OurObject
|
|
4
|
-
|
|
4
|
+
from datetime import date
|
|
5
|
+
from . import temp
|
|
5
6
|
|
|
6
7
|
class Item(OurObject):
|
|
7
8
|
def __init__(self, **kwargs):
|
|
9
|
+
temp.deprecation_warning("item","DELETE",date(2024,7,25))
|
|
8
10
|
super().__init__(**kwargs)
|
|
9
11
|
|
|
10
12
|
@abstractmethod
|
|
@@ -2,11 +2,14 @@ import json
|
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
3
|
|
|
4
4
|
from .mini_logger import MiniLogger as logger
|
|
5
|
+
from datetime import date
|
|
6
|
+
from . import temp
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
# TODO Where are we using it? Shall we extend the usage of OurObject as the father of all our entities?
|
|
8
10
|
class OurObject(ABC):
|
|
9
11
|
def __init__(self, **kwargs):
|
|
12
|
+
temp.deprecation_warning("our_object","DELETE",date(2024,7,25))
|
|
10
13
|
INIT_METHOD_NAME = '__init__'
|
|
11
14
|
logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
|
|
12
15
|
self.kwargs = kwargs
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from functools import lru_cache
|
|
2
|
+
from datetime import date
|
|
3
|
+
import inspect
|
|
4
|
+
from .mini_logger import MiniLogger as logger
|
|
5
|
+
|
|
6
|
+
@lru_cache(maxsize=64) # don't print the same warning multiple times
|
|
7
|
+
def deprecation_warning(old_name: str, new_name: str, start_date: date = None) -> None:
|
|
8
|
+
if start_date and start_date < date.today():
|
|
9
|
+
return
|
|
10
|
+
warnings_message = f"Please use {old_name} instead of {new_name}."
|
|
11
|
+
try:
|
|
12
|
+
warnings_message += " Called from: " + inspect.stack()[2].filename
|
|
13
|
+
except Exception:
|
|
14
|
+
pass
|
|
15
|
+
logger.warning(warnings_message)
|
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/unified_json.py
RENAMED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
from .valid_json_versions import valid_json_versions
|
|
2
|
-
|
|
2
|
+
from datetime import date
|
|
3
|
+
from . import temp
|
|
3
4
|
|
|
4
5
|
# TODO Shall we merge it with the machine-learning-unified-json?
|
|
5
6
|
class UnifiedJson:
|
|
6
7
|
def __init__(self, data: dict, json_version: str):
|
|
8
|
+
temp.deprecation_warning("unified_json","DELETE",date(2024,7,25))
|
|
7
9
|
if json_version not in valid_json_versions:
|
|
8
10
|
raise Exception(
|
|
9
11
|
f"version {json_version} is not in valid_json_versions {valid_json_versions}, "
|
|
@@ -6,6 +6,7 @@ import re
|
|
|
6
6
|
from datetime import date, datetime, time, timedelta, timezone
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
from urllib.parse import urlparse
|
|
9
|
+
from . import temp
|
|
9
10
|
|
|
10
11
|
import jwt
|
|
11
12
|
import requests
|
|
@@ -33,11 +34,13 @@ DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def append_if_not_exist(lst: list, item: object) -> None:
|
|
37
|
+
temp.deprecation_warning("append_if_not_exist","DELETE",date(2024,7,25))
|
|
36
38
|
if item not in lst:
|
|
37
39
|
lst.append(item)
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
def to_dict(data: json or dict or None) -> dict:
|
|
43
|
+
temp.deprecation_warning("to_dict","DELETE",date(2024,7,25))
|
|
41
44
|
if data is None:
|
|
42
45
|
return {}
|
|
43
46
|
if isinstance(data, dict):
|
|
@@ -46,6 +49,7 @@ def to_dict(data: json or dict or None) -> dict:
|
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
def to_json(data: json or dict or None) -> json:
|
|
52
|
+
temp.deprecation_warning("to_json","DELETE",date(2024,7,25))
|
|
49
53
|
if data is None:
|
|
50
54
|
data = {}
|
|
51
55
|
if isinstance(data, dict):
|
|
@@ -54,6 +58,7 @@ def to_json(data: json or dict or None) -> json:
|
|
|
54
58
|
|
|
55
59
|
|
|
56
60
|
def timedelta_to_time_format(time_delta: timedelta) -> str:
|
|
61
|
+
temp.deprecation_warning("timedelta_to_time_format","DELETE",date(2024,7,25))
|
|
57
62
|
"""
|
|
58
63
|
Convert a timedelta to a time format in HH:MM:SS.
|
|
59
64
|
|
|
@@ -90,6 +95,7 @@ def timedelta_to_time_format(time_delta: timedelta) -> str:
|
|
|
90
95
|
|
|
91
96
|
|
|
92
97
|
def is_valid_time_range(time_range: tuple) -> bool:
|
|
98
|
+
temp.deprecation_warning("is_valid_time_range","DELETE",date(2024,7,25))
|
|
93
99
|
"""
|
|
94
100
|
Validate that the time range is in the format 'HH:MM:SS'.
|
|
95
101
|
"""
|
|
@@ -116,6 +122,7 @@ def is_valid_time_range(time_range: tuple) -> bool:
|
|
|
116
122
|
# TODO shall we also use Url type and not only str? - Strongly Type which I prefer
|
|
117
123
|
# (if yes we should change it also in all the calls to this function)
|
|
118
124
|
def validate_url(url: str):
|
|
125
|
+
temp.deprecation_warning("validate_url","DELETE",date(2024,7,25))
|
|
119
126
|
logger.start(object={"url": url})
|
|
120
127
|
if url is not None or url != "":
|
|
121
128
|
parsed_url = urlparse(url)
|
|
@@ -127,6 +134,7 @@ def validate_url(url: str):
|
|
|
127
134
|
|
|
128
135
|
|
|
129
136
|
def is_valid_date_range(date_range: tuple) -> bool:
|
|
137
|
+
temp.deprecation_warning("is_valid_date_range","DELETE",date(2024,7,25))
|
|
130
138
|
"""
|
|
131
139
|
Validate that the date range is in the format 'YYYY-MM-DD'.
|
|
132
140
|
"""
|
|
@@ -145,6 +153,7 @@ def is_valid_date_range(date_range: tuple) -> bool:
|
|
|
145
153
|
|
|
146
154
|
|
|
147
155
|
def is_valid_datetime_range(datetime_range: (datetime, datetime)) -> bool:
|
|
156
|
+
temp.deprecation_warning("is_valid_datetime_range","DELETE",date(2024,7,25))
|
|
148
157
|
"""
|
|
149
158
|
Validate that the datetime range is in the format 'YYYY-MM-DD HH:MM:SS'.
|
|
150
159
|
"""
|
|
@@ -162,6 +171,7 @@ def is_valid_datetime_range(datetime_range: (datetime, datetime)) -> bool:
|
|
|
162
171
|
|
|
163
172
|
|
|
164
173
|
def is_list_of_dicts(obj: object) -> bool:
|
|
174
|
+
temp.deprecation_warning("is_list_of_dicts","DELETE",date(2024,7,25))
|
|
165
175
|
"""
|
|
166
176
|
Check if an object is a list of dictionaries.
|
|
167
177
|
|
|
@@ -206,6 +216,7 @@ def is_list_of_dicts(obj: object) -> bool:
|
|
|
206
216
|
|
|
207
217
|
|
|
208
218
|
def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
|
|
219
|
+
temp.deprecation_warning("is_time_in_time_range","DELETE",date(2024,7,25))
|
|
209
220
|
"""
|
|
210
221
|
Check if the given time is within the specified time range.
|
|
211
222
|
|
|
@@ -229,6 +240,7 @@ def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
|
|
|
229
240
|
|
|
230
241
|
|
|
231
242
|
def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
|
|
243
|
+
temp.deprecation_warning("is_date_in_date_range","DELETE",date(2024,7,25))
|
|
232
244
|
"""
|
|
233
245
|
Check if the given date is within the specified date range.
|
|
234
246
|
|
|
@@ -253,6 +265,7 @@ def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
|
|
|
253
265
|
|
|
254
266
|
|
|
255
267
|
def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (datetime, datetime)) -> bool:
|
|
268
|
+
temp.deprecation_warning("is_datetime_in_datetime_range","DELETE",date(2024,7,25))
|
|
256
269
|
"""
|
|
257
270
|
Check if the given datetime is within the specified datetime range.
|
|
258
271
|
|
|
@@ -316,6 +329,7 @@ def get_dialog_jwt_secret_key() -> str:
|
|
|
316
329
|
|
|
317
330
|
|
|
318
331
|
def encode_jwt(payload: dict, key: str) -> str:
|
|
332
|
+
temp.deprecation_warning("encode_jwt","DELETE",date(2024,7,25))
|
|
319
333
|
"""Example:
|
|
320
334
|
payload = {
|
|
321
335
|
"user_id": 123,
|
|
@@ -327,6 +341,7 @@ def encode_jwt(payload: dict, key: str) -> str:
|
|
|
327
341
|
|
|
328
342
|
|
|
329
343
|
def decode_jwt(token: str, key: str) -> dict:
|
|
344
|
+
temp.deprecation_warning("decode_jwt","DELETE",date(2024,7,25))
|
|
330
345
|
"""key can be private / public"""
|
|
331
346
|
return jwt.decode(token, key, algorithms=['HS256'])
|
|
332
347
|
|
|
@@ -362,29 +377,35 @@ def obfuscate_log_dict(log_dict: dict) -> dict:
|
|
|
362
377
|
# TODO: add tests to the following functions
|
|
363
378
|
|
|
364
379
|
def remove_digits(text: str) -> str:
|
|
380
|
+
temp.deprecation_warning("remove_digits","DELETE",date(2024,7,25))
|
|
365
381
|
return ''.join(i for i in text if not i.isdigit())
|
|
366
382
|
|
|
367
383
|
|
|
368
384
|
def generate_otp():
|
|
385
|
+
temp.deprecation_warning("generate_otp","DELETE",date(2024,7,25))
|
|
369
386
|
"""Generates a 6-digit OTP"""
|
|
370
387
|
otp = random.randint(100000, 999999)
|
|
371
388
|
return otp
|
|
372
389
|
|
|
373
390
|
|
|
374
391
|
def get_current_datetime_string(datetime_format: str = DEFAULT_DATETIME_FORMAT, tz: timezone = None) -> str:
|
|
392
|
+
temp.deprecation_warning("get_current_datetime_string","DELETE",date(2024,7,25))
|
|
375
393
|
current_datetime_string = datetime.now(tz).strftime(datetime_format)
|
|
376
394
|
return current_datetime_string
|
|
377
395
|
|
|
378
396
|
|
|
379
397
|
def datetime_from_str(date_str: str, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> datetime:
|
|
398
|
+
temp.deprecation_warning("datetime_from_str","DELETE",date(2024,7,25))
|
|
380
399
|
return datetime.strptime(date_str, datetime_format)
|
|
381
400
|
|
|
382
401
|
|
|
383
402
|
def datetime_to_str(input_datetime: datetime, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> str:
|
|
403
|
+
temp.deprecation_warning("datetime_to_str","DELETE",date(2024,7,25))
|
|
384
404
|
return input_datetime.strftime(datetime_format)
|
|
385
405
|
|
|
386
406
|
|
|
387
407
|
def validate_arguments(args: dict) -> None:
|
|
408
|
+
temp.deprecation_warning("validate_arguments","DELETE",date(2024,7,25))
|
|
388
409
|
"""
|
|
389
410
|
Validate method arguments to ensure they are not None or ''
|
|
390
411
|
:param args: arguments to be validated (usually locals())
|
|
@@ -396,6 +417,7 @@ def validate_arguments(args: dict) -> None:
|
|
|
396
417
|
|
|
397
418
|
|
|
398
419
|
def reformat_time_string(input_str: str) -> str:
|
|
420
|
+
temp.deprecation_warning("reformat_time_string","DELETE",date(2024,7,25))
|
|
399
421
|
"""Example:
|
|
400
422
|
"1234" -> "12:34:00:00"
|
|
401
423
|
"""
|
|
@@ -409,10 +431,12 @@ def reformat_time_string(input_str: str) -> str:
|
|
|
409
431
|
|
|
410
432
|
|
|
411
433
|
def get_ip_v4():
|
|
434
|
+
temp.deprecation_warning("get_ip_v4","DELETE",date(2024,7,25))
|
|
412
435
|
return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
|
|
413
436
|
|
|
414
437
|
|
|
415
438
|
def get_ip_v6():
|
|
439
|
+
temp.deprecation_warning("get_ip_v6","DELETE",date(2024,7,25))
|
|
416
440
|
return requests.get('https://api.seeip.org/jsonip').json()['ip']
|
|
417
441
|
|
|
418
442
|
|
|
@@ -429,13 +453,3 @@ def camel_to_snake(camel_str: str) -> str:
|
|
|
429
453
|
return snake_str
|
|
430
454
|
|
|
431
455
|
|
|
432
|
-
@lru_cache(maxsize=64) # don't print the same warning multiple times
|
|
433
|
-
def deprecation_warning(old_name: str, new_name: str, start_date: date = None) -> None:
|
|
434
|
-
if start_date and start_date < date.today():
|
|
435
|
-
return
|
|
436
|
-
warnings_message = f"Please use {old_name} instead of {new_name}."
|
|
437
|
-
try:
|
|
438
|
-
warnings_message += " Called from: " + inspect.stack()[2].filename
|
|
439
|
-
except Exception:
|
|
440
|
-
pass
|
|
441
|
-
logger.warning(warnings_message)
|
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
@@ -12,6 +12,7 @@ python_sdk_remote/src/http_response.py
|
|
|
12
12
|
python_sdk_remote/src/item.py
|
|
13
13
|
python_sdk_remote/src/mini_logger.py
|
|
14
14
|
python_sdk_remote/src/our_object.py
|
|
15
|
+
python_sdk_remote/src/temp.py
|
|
15
16
|
python_sdk_remote/src/unified_json.py
|
|
16
17
|
python_sdk_remote/src/utilities.py
|
|
17
18
|
python_sdk_remote/src/valid_json_versions.py
|
|
@@ -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.129', # 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.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/mini_logger.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.128 → python_sdk_remote-0.0.129}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|