python-sdk-remote 0.0.166b3060__tar.gz → 0.0.167__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.166b3060 → python_sdk_remote-0.0.167}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/mini_logger.py +0 -13
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/SOURCES.txt +0 -1
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/setup.py +1 -1
- python_sdk_remote-0.0.166b3060/python_sdk_remote/src/datadog.py +0 -88
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/README.md +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/constants.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/constants_src_mini_logger_and_logger.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/datetime_range.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/exceptions.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/generic_crud.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/http_response.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/is_test_data.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_obfuscation.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_object.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_objects.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_objects_local.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_objects_remote.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_request.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_request_old.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/utilities.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/version.py +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/setup.cfg +0 -0
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/mini_logger.py
RENAMED
|
@@ -4,11 +4,6 @@ import sys
|
|
|
4
4
|
# from enum import Enum
|
|
5
5
|
import inspect
|
|
6
6
|
from .constants_src_mini_logger_and_logger import LogMessageSeverity, StartEndEnum
|
|
7
|
-
from .datadog import Datadog, DATADOG_API_KEY
|
|
8
|
-
|
|
9
|
-
# Datadog is optional - we write to it only when DATADOG_API_KEY is set, the same
|
|
10
|
-
# behaviour as logger-local-python-package and logger-local-typescript-package
|
|
11
|
-
IS_WRITE_TO_DATADOG = bool(DATADOG_API_KEY)
|
|
12
7
|
|
|
13
8
|
# Logger configuration constants
|
|
14
9
|
LOGGER_MINIMUM_SEVERITY_DEFAULT = "INFORMATION"
|
|
@@ -85,14 +80,6 @@ class MiniLogger:
|
|
|
85
80
|
else:
|
|
86
81
|
method(f"Function: {function}, Line: {line}; {action_name} - {log_message} - {object}")
|
|
87
82
|
|
|
88
|
-
if IS_WRITE_TO_DATADOG:
|
|
89
|
-
# send_to_datadog() never raises, so this cannot break the caller
|
|
90
|
-
Datadog.send_to_datadog(
|
|
91
|
-
log_message=log_message,
|
|
92
|
-
severity_name=action_name,
|
|
93
|
-
object=object,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
83
|
@staticmethod
|
|
97
84
|
def start(log_message: str = None, **kwargs):
|
|
98
85
|
"""
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
@@ -9,7 +9,6 @@ python_sdk_remote.egg-info/top_level.txt
|
|
|
9
9
|
python_sdk_remote/src/__init__.py
|
|
10
10
|
python_sdk_remote/src/constants.py
|
|
11
11
|
python_sdk_remote/src/constants_src_mini_logger_and_logger.py
|
|
12
|
-
python_sdk_remote/src/datadog.py
|
|
13
12
|
python_sdk_remote/src/datetime_range.py
|
|
14
13
|
python_sdk_remote/src/exceptions.py
|
|
15
14
|
python_sdk_remote/src/generic_crud.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.167', # 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,88 +0,0 @@
|
|
|
1
|
-
"""Datadog log sender for MiniLogger.
|
|
2
|
-
|
|
3
|
-
Mirrors logger-local-python-package logger_local/src/datadog.py, but is
|
|
4
|
-
self-contained on purpose: logger-local depends on python-sdk-remote, so this
|
|
5
|
-
package cannot import from it without creating a circular dependency.
|
|
6
|
-
|
|
7
|
-
IMPORTANT - this module must never log through MiniLogger. logger-local's
|
|
8
|
-
datadog.py reports its own send failures via MiniLogger, so if MiniLogger's
|
|
9
|
-
Datadog path also went through MiniLogger, one failed send would trigger
|
|
10
|
-
another. Failures here go to the stdlib logger below and stop there.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
import logging
|
|
14
|
-
import os
|
|
15
|
-
import sys
|
|
16
|
-
|
|
17
|
-
import requests
|
|
18
|
-
|
|
19
|
-
# Deliberately the stdlib logger, NOT MiniLogger - see the module docstring.
|
|
20
|
-
_logger = logging.getLogger(__name__)
|
|
21
|
-
|
|
22
|
-
# US1 (app.datadoghq.com) - the Datadog site the Circlez organization is on.
|
|
23
|
-
# Datadog regions are separate instances: an API key issued in one site is
|
|
24
|
-
# rejected by the others, so this must match the org the key belongs to.
|
|
25
|
-
DATADOG_SITE: str = os.getenv("DATADOG_SITE") or "datadoghq.com"
|
|
26
|
-
DATADOG_URL = f"https://http-intake.logs.{DATADOG_SITE}/api/v2/logs"
|
|
27
|
-
|
|
28
|
-
DATADOG_API_KEY: str = os.getenv("DATADOG_API_KEY")
|
|
29
|
-
|
|
30
|
-
DATADOG_REQUEST_TIMEOUT_SECONDS = 5
|
|
31
|
-
|
|
32
|
-
# Our severity names mapped to Datadog's log status values.
|
|
33
|
-
# Without an explicit "status" Datadog files everything as "info", which makes
|
|
34
|
-
# error monitors useless - see https://docs.datadoghq.com/logs/log_configuration/pipelines/#log-status-remapper
|
|
35
|
-
SEVERITY_NAME_TO_DATADOG_STATUS = {
|
|
36
|
-
"DEBUG": "debug",
|
|
37
|
-
"VERBOSE": "debug",
|
|
38
|
-
"INIT": "debug",
|
|
39
|
-
"START": "debug",
|
|
40
|
-
"END": "debug",
|
|
41
|
-
"INFORMATION": "info",
|
|
42
|
-
"WARNING": "warn",
|
|
43
|
-
"ERROR": "error",
|
|
44
|
-
"CRITICAL": "critical",
|
|
45
|
-
"EXCEPTION": "error",
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class Datadog:
|
|
50
|
-
@staticmethod
|
|
51
|
-
def send_to_datadog(log_message: str = None, severity_name: str = None, object: dict = None) -> None:
|
|
52
|
-
"""Sends one MiniLogger line to Datadog.
|
|
53
|
-
|
|
54
|
-
No-op when DATADOG_API_KEY is unset. Never raises - a logging failure
|
|
55
|
-
must not break the caller.
|
|
56
|
-
|
|
57
|
-
Parameters:
|
|
58
|
-
log_message (str): the message text
|
|
59
|
-
severity_name (str): a LogMessageSeverity/StartEndEnum name, mapped to a Datadog status
|
|
60
|
-
object (dict): optional extra attributes to attach to the log
|
|
61
|
-
"""
|
|
62
|
-
if not DATADOG_API_KEY:
|
|
63
|
-
return
|
|
64
|
-
try:
|
|
65
|
-
# If sys.meta_path is None, Python is likely shutting down
|
|
66
|
-
if not sys.meta_path:
|
|
67
|
-
return
|
|
68
|
-
payload = {
|
|
69
|
-
"ddsource": "python",
|
|
70
|
-
"service": "circlez",
|
|
71
|
-
# Lets you separate MiniLogger traffic from logger-local traffic
|
|
72
|
-
# in the Log Explorer with logger:mini_logger
|
|
73
|
-
"logger": "mini_logger",
|
|
74
|
-
"status": SEVERITY_NAME_TO_DATADOG_STATUS.get(severity_name, "info"),
|
|
75
|
-
"severity_name": severity_name,
|
|
76
|
-
"message": log_message or "",
|
|
77
|
-
}
|
|
78
|
-
if object:
|
|
79
|
-
payload["object"] = str(object)
|
|
80
|
-
requests.post(
|
|
81
|
-
DATADOG_URL,
|
|
82
|
-
headers={"DD-API-KEY": DATADOG_API_KEY, "Content-Type": "application/json"},
|
|
83
|
-
json=payload,
|
|
84
|
-
timeout=DATADOG_REQUEST_TIMEOUT_SECONDS,
|
|
85
|
-
)
|
|
86
|
-
except Exception as exception:
|
|
87
|
-
# Must not go through MiniLogger - see the module docstring
|
|
88
|
-
_logger.debug("Failed to send log to Datadog, continue anyway. exception=%s", exception)
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/__init__.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/datetime_range.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/exceptions.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/generic_crud.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/http_response.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/is_test_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_object.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_objects.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/our_request.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/utilities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote/src/version.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.166b3060 → python_sdk_remote-0.0.167}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|