secploy 0.2.7__tar.gz → 0.2.9__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.
- {secploy-0.2.7 → secploy-0.2.9}/LICENSE +1 -1
- {secploy-0.2.7/secploy.egg-info → secploy-0.2.9}/PKG-INFO +2 -2
- {secploy-0.2.7 → secploy-0.2.9}/secploy/__init__.py +1 -1
- {secploy-0.2.7 → secploy-0.2.9}/secploy/client.py +26 -22
- {secploy-0.2.7 → secploy-0.2.9}/secploy/lib/config.py +7 -0
- secploy-0.2.9/secploy/utils.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9/secploy.egg-info}/PKG-INFO +2 -2
- {secploy-0.2.7 → secploy-0.2.9}/secploy.egg-info/SOURCES.txt +1 -0
- {secploy-0.2.7 → secploy-0.2.9}/setup.py +2 -2
- {secploy-0.2.7 → secploy-0.2.9}/MANIFEST.in +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/README.md +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/enums.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/events.py +0 -0
- /secploy-0.2.7/secploy/utils.py → /secploy-0.2.9/secploy/handlers.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/lib/__init__.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/lib/secploy_logger.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/log_capture.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/processor.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy/schemas.py +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy.egg-info/dependency_links.txt +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy.egg-info/entry_points.txt +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy.egg-info/requires.txt +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/secploy.egg-info/top_level.txt +0 -0
- {secploy-0.2.7 → secploy-0.2.9}/setup.cfg +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: secploy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Event tracking and monitoring SDK for Python applications
|
|
5
5
|
Home-page: https://github.com/agastronics/secploy-python-sdk
|
|
6
6
|
Author: Agastronics
|
|
7
|
-
Author-email: support@
|
|
7
|
+
Author-email: support@secploy.com
|
|
8
8
|
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -6,7 +6,7 @@ from .client import SecployClient
|
|
|
6
6
|
from .schemas import SecployConfig
|
|
7
7
|
from .schemas import LogLevel
|
|
8
8
|
|
|
9
|
-
__version__ = "0.2.
|
|
9
|
+
__version__ = "0.2.9"
|
|
10
10
|
__author__ = "Agastronics"
|
|
11
11
|
__email__ = "support@agastronics.com"
|
|
12
12
|
__description__ = "Event tracking and monitoring SDK for Python applications"
|
|
@@ -3,6 +3,8 @@ import logging
|
|
|
3
3
|
from typing import Any, Dict, Optional, List, Union
|
|
4
4
|
import queue
|
|
5
5
|
|
|
6
|
+
from secploy.lib.config import config_to_namespace
|
|
7
|
+
|
|
6
8
|
from .lib import setup_logger, load_config, DEFAULT_CONFIG, secploy_logger
|
|
7
9
|
from .schemas import SecployConfig, LogLevel
|
|
8
10
|
from .log_capture import SecployLogCapturer
|
|
@@ -34,8 +36,9 @@ class SecployClient:
|
|
|
34
36
|
TypeError: If configuration values have invalid types
|
|
35
37
|
"""
|
|
36
38
|
# Load config from file if provided else it will load from default locations or find .secploy
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
config_dict = load_config(config_file)
|
|
40
|
+
config = config_to_namespace(config_dict)
|
|
41
|
+
|
|
39
42
|
if config is None:
|
|
40
43
|
secploy_logger.error("No valid configuration found")
|
|
41
44
|
return
|
|
@@ -49,40 +52,41 @@ class SecployClient:
|
|
|
49
52
|
config.organization_id = organization_id
|
|
50
53
|
|
|
51
54
|
# Special handling for log_level if it's a string
|
|
52
|
-
|
|
55
|
+
log_level = getattr(config, 'log_level', None)
|
|
56
|
+
if isinstance(log_level, str):
|
|
53
57
|
try:
|
|
54
|
-
config
|
|
58
|
+
setattr(config, 'log_level', LogLevel(log_level.upper()))
|
|
55
59
|
except ValueError:
|
|
56
60
|
raise ValueError(
|
|
57
|
-
f"Invalid log level: {
|
|
61
|
+
f"Invalid log level: {log_level}. Must be one of: "
|
|
58
62
|
f"{', '.join(level.value for level in LogLevel)}"
|
|
59
63
|
)
|
|
60
64
|
|
|
61
65
|
# Validate required fields
|
|
62
|
-
if not config
|
|
66
|
+
if not getattr(config, 'api_key', None):
|
|
63
67
|
raise ValueError("API key is required")
|
|
64
|
-
if not config
|
|
68
|
+
if not getattr(config, 'environment_key', None):
|
|
65
69
|
raise ValueError("Environment key is required")
|
|
66
|
-
if not config
|
|
70
|
+
if not getattr(config, 'organization_id', None):
|
|
67
71
|
raise ValueError("Organization ID is required")
|
|
68
|
-
if not config
|
|
72
|
+
if not getattr(config, 'ingest_url', None):
|
|
69
73
|
raise ValueError("Ingest URL is required")
|
|
70
74
|
|
|
71
75
|
# Set instance attributes from config
|
|
72
|
-
self.api_key = config
|
|
73
|
-
self.environment_key = config
|
|
74
|
-
self.organization_id = config
|
|
75
|
-
self.environment = config
|
|
76
|
-
self.sampling_rate = config
|
|
77
|
-
self.ingest_url = config
|
|
78
|
-
self.heartbeat_interval = config
|
|
79
|
-
self.max_retry = config
|
|
80
|
-
self.debug = config
|
|
81
|
-
self.log_level = config
|
|
82
|
-
|
|
76
|
+
self.api_key = getattr(config, 'api_key')
|
|
77
|
+
self.environment_key = getattr(config, 'environment_key', None)
|
|
78
|
+
self.organization_id = getattr(config, 'organization_id', None)
|
|
79
|
+
self.environment = getattr(config, 'environment', 'development')
|
|
80
|
+
self.sampling_rate = getattr(config, 'sampling_rate', 1.0)
|
|
81
|
+
self.ingest_url = getattr(config, 'ingest_url').rstrip("/")
|
|
82
|
+
self.heartbeat_interval = getattr(config, 'heartbeat_interval', 60)
|
|
83
|
+
self.max_retry = getattr(config, 'max_retry', 5)
|
|
84
|
+
self.debug = getattr(config, 'debug', False)
|
|
85
|
+
self.log_level = getattr(config, 'log_level', 'INFO')
|
|
86
|
+
|
|
83
87
|
# Batch processing configuration
|
|
84
|
-
self.batch_size = config
|
|
85
|
-
self.flush_interval = config
|
|
88
|
+
self.batch_size = getattr(config, 'batch_size', 100) # Max events per batch
|
|
89
|
+
self.flush_interval = getattr(config, 'flush_interval', 60) # Max seconds between flushes
|
|
86
90
|
|
|
87
91
|
# Initialize internal state
|
|
88
92
|
self._event_queue = queue.Queue()
|
|
@@ -11,6 +11,7 @@ import os # For path checks
|
|
|
11
11
|
import glob # For finding config files
|
|
12
12
|
import logging
|
|
13
13
|
from typing import Dict, Optional, Union
|
|
14
|
+
from types import SimpleNamespace
|
|
14
15
|
|
|
15
16
|
logger = logging.getLogger(__name__)
|
|
16
17
|
|
|
@@ -160,6 +161,12 @@ def load_config(file_path: Optional[str] = None) -> Dict[str, Union[str, int, fl
|
|
|
160
161
|
|
|
161
162
|
return config
|
|
162
163
|
|
|
164
|
+
def config_to_namespace(config: Dict[str, Union[str, int, float, bool, None]]) -> SimpleNamespace:
|
|
165
|
+
"""
|
|
166
|
+
Converts a config dict to an object with attribute access.
|
|
167
|
+
"""
|
|
168
|
+
return SimpleNamespace(**config)
|
|
169
|
+
|
|
163
170
|
|
|
164
171
|
def validate_config(config: Dict[str, Union[str, int, float, bool, None]]) -> bool:
|
|
165
172
|
"""
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: secploy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Event tracking and monitoring SDK for Python applications
|
|
5
5
|
Home-page: https://github.com/agastronics/secploy-python-sdk
|
|
6
6
|
Author: Agastronics
|
|
7
|
-
Author-email: support@
|
|
7
|
+
Author-email: support@secploy.com
|
|
8
8
|
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="secploy",
|
|
5
|
-
version="0.2.
|
|
5
|
+
version="0.2.9",
|
|
6
6
|
packages=find_packages(),
|
|
7
7
|
install_requires=[
|
|
8
8
|
"requests>=2.25.0",
|
|
@@ -10,7 +10,7 @@ setup(
|
|
|
10
10
|
"pydantic>=2.0.0",
|
|
11
11
|
],
|
|
12
12
|
author="Agastronics",
|
|
13
|
-
author_email="support@
|
|
13
|
+
author_email="support@secploy.com",
|
|
14
14
|
description="Event tracking and monitoring SDK for Python applications",
|
|
15
15
|
long_description=open("README.md").read() if open("README.md") else "",
|
|
16
16
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|