python-sdk-remote 0.0.113__tar.gz → 0.0.115__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.113 → python_sdk_remote-0.0.115}/PKG-INFO +2 -1
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/utilities.py +64 -3
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/PKG-INFO +2 -1
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/requires.txt +1 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/setup.py +2 -1
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/README.md +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/http_response.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/mini_logger.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/our_object.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-remote
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.115
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: License :: Other/Proprietary License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: requests
|
|
12
13
|
Requires-Dist: python-dotenv
|
|
13
14
|
Requires-Dist: url-remote
|
|
14
15
|
Requires-Dist: pyjwt
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import jwt
|
|
3
|
+
import requests
|
|
3
4
|
import re
|
|
4
5
|
import os
|
|
5
|
-
|
|
6
|
+
import random
|
|
7
|
+
from datetime import date, datetime, time, timedelta, timezone
|
|
6
8
|
from urllib.parse import urlparse
|
|
7
9
|
|
|
8
10
|
from dotenv import load_dotenv
|
|
@@ -15,6 +17,9 @@ from .http_response import (create_authorization_http_headers, # noqa - used fo
|
|
|
15
17
|
create_http_body)
|
|
16
18
|
|
|
17
19
|
load_dotenv()
|
|
20
|
+
override = True if os.getenv("override", "").lower() in ("t", "true", "0") else False
|
|
21
|
+
load_dotenv(dotenv_path=os.environ.get("DOTENV_PATH"), override=override) # add another .env file if needed
|
|
22
|
+
|
|
18
23
|
# raise Exception("Failed to load environment variables from .env file\n"
|
|
19
24
|
# "Please check if the file exists, maybe you are not in the right venv?")
|
|
20
25
|
|
|
@@ -22,6 +27,9 @@ load_dotenv()
|
|
|
22
27
|
|
|
23
28
|
# TODO Use the const/enum from language package
|
|
24
29
|
DEFAULT_LANG_CODE_STR = "en"
|
|
30
|
+
# TODO If no one is using DEFAULT_DATETIME_FORMAT, let's comment it
|
|
31
|
+
# TODO Lets split DEFAULT_DATETIME_FORMAT into two const 1. Displayable to Humans (MMM) 2. Internal (sortable) with %m
|
|
32
|
+
DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
25
33
|
|
|
26
34
|
|
|
27
35
|
def append_if_not_exist(lst: list, item: object) -> None:
|
|
@@ -302,8 +310,8 @@ def get_sql_password() -> str:
|
|
|
302
310
|
return our_get_env("RDS_PASSWORD")
|
|
303
311
|
|
|
304
312
|
|
|
305
|
-
def
|
|
306
|
-
return our_get_env("
|
|
313
|
+
def get_dialog_jwt_secret_key() -> str:
|
|
314
|
+
return our_get_env("DIALOG_JWT_SECRET_KEY", raise_if_empty=True)
|
|
307
315
|
|
|
308
316
|
|
|
309
317
|
def encode_jwt(payload: dict, key: str) -> str:
|
|
@@ -343,11 +351,64 @@ def obfuscate_log_dict(log_dict: dict) -> dict:
|
|
|
343
351
|
if isinstance(value, dict):
|
|
344
352
|
obfuscated_log_dict[key] = obfuscate_log_dict(value)
|
|
345
353
|
elif re.search(r'password|secret|token|jwt|e[\-_]?mail|phone|name|address|ssn', key, re.IGNORECASE):
|
|
354
|
+
# TODO Maybe we can reveal a small part
|
|
346
355
|
obfuscated_log_dict[key] = "***"
|
|
347
356
|
else:
|
|
348
357
|
obfuscated_log_dict[key] = value
|
|
349
358
|
return obfuscated_log_dict
|
|
350
359
|
|
|
360
|
+
# TODO: add tests to the following functions
|
|
351
361
|
|
|
352
362
|
def remove_digits(text: str) -> str:
|
|
353
363
|
return ''.join(i for i in text if not i.isdigit())
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def generate_otp():
|
|
367
|
+
"""Generates a 6-digit OTP"""
|
|
368
|
+
otp = random.randint(100000, 999999)
|
|
369
|
+
return otp
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def get_current_datetime_string(datetime_format: str = DEFAULT_DATETIME_FORMAT, tz: timezone = None) -> str:
|
|
373
|
+
current_datetime_string = datetime.now(tz).strftime(datetime_format)
|
|
374
|
+
return current_datetime_string
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
def datetime_from_str(date_str: str, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> datetime:
|
|
378
|
+
return datetime.strptime(date_str, datetime_format)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def datetime_to_str(input_datetime: datetime, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> str:
|
|
382
|
+
return input_datetime.strftime(datetime_format)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def validate_arguments(args: dict) -> None:
|
|
386
|
+
"""
|
|
387
|
+
Validate method arguments to ensure they are not None or ''
|
|
388
|
+
:param args: arguments to be validated (usually locals())
|
|
389
|
+
:return: True if all arguments are not None or '', False otherwise
|
|
390
|
+
"""
|
|
391
|
+
for arg, value in args.items():
|
|
392
|
+
if not arg:
|
|
393
|
+
raise ValueError(f"Argument {arg} is cannot be empty (got {value})")
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def reformat_time_string(input_str: str) -> str:
|
|
397
|
+
"""Example:
|
|
398
|
+
"1234" -> "12:34:00:00"
|
|
399
|
+
"""
|
|
400
|
+
hours = input_str[:2]
|
|
401
|
+
minutes = "00" if len(input_str) < 4 else input_str[2:4]
|
|
402
|
+
seconds = "00" if len(input_str) < 6 else input_str[4:6]
|
|
403
|
+
milliseconds = "00" if len(input_str) < 8 else input_str[6:8]
|
|
404
|
+
# TODO Shall we use DEFAULT_DATETIME_FORMAT and have the formats in central
|
|
405
|
+
time_format = f"{hours}:{minutes}:{seconds}:{milliseconds}"
|
|
406
|
+
return time_format
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def get_ip_v4():
|
|
410
|
+
return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def get_ip_v6():
|
|
414
|
+
return requests.get('https://api.seeip.org/jsonip').json()['ip']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-remote
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.115
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: License :: Other/Proprietary License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: requests
|
|
12
13
|
Requires-Dist: python-dotenv
|
|
13
14
|
Requires-Dist: url-remote
|
|
14
15
|
Requires-Dist: pyjwt
|
|
@@ -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.115', # 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",
|
|
@@ -23,6 +23,7 @@ setuptools.setup(
|
|
|
23
23
|
"Operating System :: OS Independent",
|
|
24
24
|
],
|
|
25
25
|
install_requires=[
|
|
26
|
+
"requests",
|
|
26
27
|
"python-dotenv",
|
|
27
28
|
"url-remote",
|
|
28
29
|
"pyjwt",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/http_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/mini_logger.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.113 → python_sdk_remote-0.0.115}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|