python-sdk-local 0.0.136__tar.gz → 0.0.138__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.
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/PKG-INFO +1 -2
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/http_response.py +6 -7
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/utilities.py +5 -19
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/PKG-INFO +1 -2
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/requires.txt +0 -1
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/setup.py +1 -2
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/README.md +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/pyproject.toml +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/__init__.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/constants.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/item.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/our_object.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/unified_json.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/valid_json_versions.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/validate_environment.py +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/SOURCES.txt +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/dependency_links.txt +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/top_level.txt +0 -0
- {python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.138
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -11,7 +11,6 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: requests
|
|
13
13
|
Requires-Dist: python-dotenv
|
|
14
|
-
Requires-Dist: url-remote
|
|
15
14
|
Requires-Dist: pyjwt
|
|
16
15
|
Requires-Dist: python-sdk-remote
|
|
17
16
|
Requires-Dist: user-context-remote
|
|
@@ -2,7 +2,7 @@ import traceback
|
|
|
2
2
|
from functools import wraps
|
|
3
3
|
from http import HTTPStatus
|
|
4
4
|
from typing import Any
|
|
5
|
-
|
|
5
|
+
# TODO: use logger_local everywhere with meta loggers & remove logger start/end
|
|
6
6
|
from python_sdk_remote.mini_logger import MiniLogger as logger
|
|
7
7
|
from user_context_remote.user_context import UserContext
|
|
8
8
|
|
|
@@ -16,11 +16,9 @@ AUTHORIZATION_PREFIX = 'Bearer '
|
|
|
16
16
|
# 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
|
|
17
17
|
# TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
|
|
18
18
|
|
|
19
|
-
# TODO: add handler wrapper?
|
|
20
|
-
|
|
21
19
|
def get_payload_dict_from_event(event: dict) -> dict:
|
|
22
20
|
"""Extracts params sent with payload"""
|
|
23
|
-
return to_dict(event.get('body'))
|
|
21
|
+
return to_dict(event.get('body')) # TODO all `return statement` should be `return variable`
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
def get_path_parameters_dict_from_event(event: dict) -> dict:
|
|
@@ -118,8 +116,8 @@ def create_error_http_response(exception: Exception, status_code: HTTPStatus = H
|
|
|
118
116
|
error_http_response = {
|
|
119
117
|
"statusCode": status_code.value,
|
|
120
118
|
"headers": create_return_http_headers(),
|
|
121
|
-
"body": create_http_body({"error": str(exception)
|
|
122
|
-
|
|
119
|
+
"body": create_http_body({"error": str(exception),
|
|
120
|
+
"traceback": traceback.format_exc()}),
|
|
123
121
|
}
|
|
124
122
|
logger.end(object={"error_http_response": error_http_response})
|
|
125
123
|
return error_http_response
|
|
@@ -128,7 +126,8 @@ def create_error_http_response(exception: Exception, status_code: HTTPStatus = H
|
|
|
128
126
|
def create_ok_http_response(body: Any) -> dict:
|
|
129
127
|
logger.start(object={"body": body})
|
|
130
128
|
# TODO: test sending statusCode/headers/body inside the body
|
|
131
|
-
|
|
129
|
+
if isinstance(body, str) and body.startswith("{") and body.endswith("}"):
|
|
130
|
+
body = to_dict(body)
|
|
132
131
|
if isinstance(body, dict):
|
|
133
132
|
status_code = body.get("statusCode")
|
|
134
133
|
headers = body.get("headers")
|
|
@@ -6,19 +6,16 @@ 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
|
-
import warnings
|
|
10
9
|
import jwt
|
|
11
10
|
import requests
|
|
12
11
|
from dotenv import load_dotenv
|
|
13
|
-
from url_remote.environment_name_enum import EnvironmentName
|
|
14
12
|
|
|
15
13
|
from python_sdk_remote.mini_logger import MiniLogger as logger
|
|
16
14
|
|
|
17
|
-
|
|
18
15
|
load_dotenv()
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
override = True if os.getenv("
|
|
16
|
+
# If DOTENV_PATH is defined, load the environment variables from the specified file
|
|
17
|
+
# If OVERRIDE_DOTENV is set to True, override the existing environment variables
|
|
18
|
+
override = True if os.getenv("OVERRIDE_DOTENV", "").lower() in ("t", "true", "0") else False
|
|
22
19
|
load_dotenv(dotenv_path=os.environ.get("DOTENV_PATH"), override=override) # add another .env file if needed
|
|
23
20
|
|
|
24
21
|
# raise Exception("Failed to load environment variables from .env file\n"
|
|
@@ -277,7 +274,6 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (dat
|
|
|
277
274
|
return is_datetime_in_datetime_range_result
|
|
278
275
|
|
|
279
276
|
|
|
280
|
-
|
|
281
277
|
def encode_jwt(payload: dict, key: str) -> str:
|
|
282
278
|
"""Example:
|
|
283
279
|
payload = {
|
|
@@ -343,10 +339,12 @@ def reformat_time_string(input_str: str) -> str:
|
|
|
343
339
|
return time_format
|
|
344
340
|
|
|
345
341
|
|
|
342
|
+
@lru_cache(maxsize=1)
|
|
346
343
|
def get_ip_v4():
|
|
347
344
|
return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
|
|
348
345
|
|
|
349
346
|
|
|
347
|
+
@lru_cache(maxsize=1)
|
|
350
348
|
def get_ip_v6():
|
|
351
349
|
return requests.get('https://api.seeip.org/jsonip').json()['ip']
|
|
352
350
|
|
|
@@ -362,15 +360,3 @@ def camel_to_snake(camel_str: str) -> str:
|
|
|
362
360
|
"""Converts camelCase to snake_case."""
|
|
363
361
|
snake_str = re.sub(r'(?<!^)(?=[A-Z])', '_', camel_str).lower()
|
|
364
362
|
return snake_str
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
@lru_cache(maxsize=64) # don't print the same warning multiple times
|
|
368
|
-
def deprecation_warning(old_name: str, new_name: str, start_date: date = None) -> None:
|
|
369
|
-
if start_date and start_date < date.today():
|
|
370
|
-
return
|
|
371
|
-
warnings_message = f"Please use {old_name} instead of {new_name}."
|
|
372
|
-
try:
|
|
373
|
-
warnings_message += " Called from: " + inspect.stack()[2].filename
|
|
374
|
-
except Exception:
|
|
375
|
-
pass
|
|
376
|
-
logger.warning(warnings_message)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-sdk-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.138
|
|
4
4
|
Summary: PyPI Package for Circles Python SDK Local Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/python-sdk-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -11,7 +11,6 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: requests
|
|
13
13
|
Requires-Dist: python-dotenv
|
|
14
|
-
Requires-Dist: url-remote
|
|
15
14
|
Requires-Dist: pyjwt
|
|
16
15
|
Requires-Dist: python-sdk-remote
|
|
17
16
|
Requires-Dist: user-context-remote
|
|
@@ -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.138', # https://pypi.org/project/python-sdk-local/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circlez.ai",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
@@ -25,7 +25,6 @@ setuptools.setup(
|
|
|
25
25
|
install_requires=[
|
|
26
26
|
"requests",
|
|
27
27
|
"python-dotenv",
|
|
28
|
-
"url-remote",
|
|
29
28
|
"pyjwt",
|
|
30
29
|
"python-sdk-remote",
|
|
31
30
|
"user-context-remote",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/valid_json_versions.py
RENAMED
|
File without changes
|
{python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local/src/validate_environment.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_sdk_local-0.0.136 → python_sdk_local-0.0.138}/python_sdk_local.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|