python-sdk-remote 0.0.124__tar.gz → 0.0.126__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.124 → python_sdk_remote-0.0.126}/PKG-INFO +1 -1
- python_sdk_remote-0.0.126/README.md +11 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/constants.py +0 -9
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/http_response.py +7 -6
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/utilities.py +17 -3
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/setup.py +1 -1
- python_sdk_remote-0.0.124/README.md +0 -27
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/mini_logger.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/our_object.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/setup.cfg +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# TODO: rewrite with more example
|
|
2
|
+
|
|
3
|
+
In serverless, use this decorator:
|
|
4
|
+
```py
|
|
5
|
+
from python_sdk_remote.http_response import handler_decorator
|
|
6
|
+
from logger_local.Logger import Logger
|
|
7
|
+
logger = Logger.create_logger(object=your_logger_object)
|
|
8
|
+
@handler_decorator(logger=logger)
|
|
9
|
+
def my_handler(request_parameters: dict) -> dict:
|
|
10
|
+
# here you can use both camelCase and snake_case keys from request_parameters
|
|
11
|
+
```
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
1
|
from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
4
2
|
|
|
5
3
|
PYTHON_SDK_REMOTE_COMPONENT_ID = 184
|
|
6
4
|
PYTHON_SDK_REMOTE_COMPONENT_NAME = 'python_sdk_remote'
|
|
7
5
|
|
|
8
|
-
ENVIRONMENT_NAME = os.getenv("ENVIRONMENT_NAME")
|
|
9
|
-
BRAND_NAME = os.getenv("BRAND_NAME")
|
|
10
|
-
LOGZIO_TOKEN = os.getenv("LOGZIO_TOKEN")
|
|
11
|
-
# TODO Shall Can we use python-sdk function to get the value from Environment?
|
|
12
|
-
# TODO Shall we get the value from environment here of send the value to the function as @akiva-skolnik did?
|
|
13
|
-
GOOGLE_PORT_FOR_AUTHENTICATION = os.getenv("PORT_FOR_AUTHENTICATION")
|
|
14
|
-
|
|
15
6
|
OBJECT_TO_INSERT_CODE = {
|
|
16
7
|
'component_id': PYTHON_SDK_REMOTE_COMPONENT_ID,
|
|
17
8
|
'component_name': PYTHON_SDK_REMOTE_COMPONENT_NAME,
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/http_response.py
RENAMED
|
@@ -36,12 +36,12 @@ def get_request_parameters_from_event(event: dict) -> dict:
|
|
|
36
36
|
"""Extracts all params from the event object.
|
|
37
37
|
The order of precedence is: payload > path > query string
|
|
38
38
|
returns a dictionary with all the parameters, with both camelCase and snake_case keys."""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
39
|
+
all_parameters_dict = get_payload_dict_from_event(event)
|
|
40
|
+
all_parameters_dict.update(get_path_parameters_dict_from_event(event))
|
|
41
|
+
all_parameters_dict.update(get_query_string_parameters_from_event(event))
|
|
42
|
+
all_parameters_dict = {camel_to_snake(key): value for key, value in all_parameters_dict.items()}
|
|
43
|
+
all_parameters_dict.update({snake_to_camel(key): value for key, value in all_parameters_dict.items()})
|
|
44
|
+
return all_parameters_dict
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
# TODO: test
|
|
@@ -74,6 +74,7 @@ def handler_decorator(logger):
|
|
|
74
74
|
return decorator
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
# TODO: should we auto detect user_jwt if not provided?
|
|
77
78
|
def create_authorization_http_headers(user_jwt: str) -> dict:
|
|
78
79
|
logger.start(object={"user_jwt": user_jwt})
|
|
79
80
|
authorization_http_headers = {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import inspect
|
|
1
2
|
import json
|
|
2
|
-
import jwt
|
|
3
|
-
import requests
|
|
4
|
-
import re
|
|
5
3
|
import os
|
|
6
4
|
import random
|
|
5
|
+
import re
|
|
7
6
|
from datetime import date, datetime, time, timedelta, timezone
|
|
7
|
+
from functools import lru_cache
|
|
8
8
|
from urllib.parse import urlparse
|
|
9
9
|
|
|
10
|
+
import jwt
|
|
11
|
+
import requests
|
|
10
12
|
from dotenv import load_dotenv
|
|
11
13
|
from url_remote.environment_name_enum import EnvironmentName
|
|
12
14
|
|
|
@@ -425,3 +427,15 @@ def camel_to_snake(camel_str: str) -> str:
|
|
|
425
427
|
"""Converts camelCase to snake_case."""
|
|
426
428
|
snake_str = re.sub(r'(?<!^)(?=[A-Z])', '_', camel_str).lower()
|
|
427
429
|
return snake_str
|
|
430
|
+
|
|
431
|
+
|
|
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)
|
|
@@ -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.126', # 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",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# python-sdk-package
|
|
2
|
-
|
|
3
|
-
https://github.com/grosser/repo_dependency_graph Ruby, Graph the dependencies of your repositories
|
|
4
|
-
https://github.com/thebjorn/pydeps Python
|
|
5
|
-
|
|
6
|
-
To create local package and remote package layers (not to create GraphQL and REST-API layers)
|
|
7
|
-
|
|
8
|
-
#database Python scripts in /db folder
|
|
9
|
-
Please place <table-name>.py in /db<br>
|
|
10
|
-
No need for seperate file for _ml table<br>
|
|
11
|
-
Please delete the example file if not needed<br>
|
|
12
|
-
|
|
13
|
-
# Create the files to create the database schema, tables, view and populate Meta Data and Test Date
|
|
14
|
-
|
|
15
|
-
/db/<table-name>.py - CREATE SCHEMA ... CREATE TABLE ... CREATE VIEW ...<br>
|
|
16
|
-
/db/<table-name>_insert.py to create records
|
|
17
|
-
|
|
18
|
-
# Update the setup.py (i.e.name, version)
|
|
19
|
-
|
|
20
|
-
# Please create test directory inside the directory of the project i.e. /<project-name>/tests
|
|
21
|
-
|
|
22
|
-
# Update the serverless.yml in the root directory
|
|
23
|
-
|
|
24
|
-
provider:
|
|
25
|
-
stage: play1
|
|
26
|
-
|
|
27
|
-
Update the endpoints in serverless.yml
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/mini_logger.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.124 → python_sdk_remote-0.0.126}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|