nui-python-shared-utils 1.3.1__py3-none-any.whl → 1.3.2__py3-none-any.whl
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.
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/METADATA +1 -1
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/RECORD +8 -8
- nui_shared_utils/es_client.py +4 -4
- nui_shared_utils/secrets_helper.py +17 -1
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/WHEEL +0 -0
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/entry_points.txt +0 -0
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/licenses/LICENSE +0 -0
- {nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/top_level.txt +0 -0
{nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nui-python-shared-utils
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: Shared Python utilities for AWS Lambda, CLI tools, and agents with Slack, Elasticsearch, and monitoring integrations
|
|
5
5
|
Home-page: https://github.com/nuimarkets/nui-python-shared-utils
|
|
6
6
|
Author: NUI Markets
|
|
@@ -20,7 +20,7 @@ nui_lambda_shared_utils/slack_setup/__init__.py,sha256=q78NzSznsSd3ri5OUohWxQt7r
|
|
|
20
20
|
nui_lambda_shared_utils/slack_setup/channel_creator.py,sha256=xaeqzyEAqVqYj2EhN69UvcyZQ6LdFKYODPPCwxHInLA,172
|
|
21
21
|
nui_lambda_shared_utils/slack_setup/channel_definitions.py,sha256=3TkdLzWvEMBMDy5jqOPMUGRgKQ3z9TN58D43V7O7LpE,180
|
|
22
22
|
nui_lambda_shared_utils/slack_setup/setup_helpers.py,sha256=ex_RiUfiZqH9qGLQwmedezMbfp35uI-VQPevducfbBk,168
|
|
23
|
-
nui_python_shared_utils-1.3.
|
|
23
|
+
nui_python_shared_utils-1.3.2.dist-info/licenses/LICENSE,sha256=vGe2mC5yLUb8toYlY3T36ZwCB5zQUW5hlCtEMiqokhM,1071
|
|
24
24
|
nui_shared_utils/__init__.py,sha256=0yYLzo2zggr43W2zdybp7PBc5oPsU-kwh1M1r7CuFv4,6617
|
|
25
25
|
nui_shared_utils/base_client.py,sha256=I1lKQGhrKyvujV2zps0TrtEdPDqMCwRQaIh6ceGONXQ,11016
|
|
26
26
|
nui_shared_utils/cli.py,sha256=JJpSoQWKvAz4b8cO30yFNi5vY9jmqrCHzbFpvrVTkbU,8747
|
|
@@ -28,13 +28,13 @@ nui_shared_utils/cloudwatch_metrics.py,sha256=Rdyfy-3zAQqZkPL2krzjyB3FXYgrh7Hx56
|
|
|
28
28
|
nui_shared_utils/config.py,sha256=ZbkUKDxnHMJiHNv-TlWKjotmf2mH1Vz3GaIXgGfWg7E,4524
|
|
29
29
|
nui_shared_utils/db_client.py,sha256=HyVKJ1Su0dVPV1QI2MU5UtT8myDRCjKgV60xRL4SEdE,21726
|
|
30
30
|
nui_shared_utils/error_handler.py,sha256=pJ6b_mI0Ait8QRbs9UmLzYUN-Ft0l_dnpudVO_6LRSE,12171
|
|
31
|
-
nui_shared_utils/es_client.py,sha256=
|
|
31
|
+
nui_shared_utils/es_client.py,sha256=rLyexuL6_RXQpuMC4A2SeJDk30medx2qxOgWIG3A_7o,15765
|
|
32
32
|
nui_shared_utils/es_query_builder.py,sha256=UuheQf8b2UXaOiJlYCKYIfKfVERDZ3ag1P0OOOWm9do,12158
|
|
33
33
|
nui_shared_utils/jwt_auth.py,sha256=2Ag1zZKxd2R8QBz3aQA4h8OtKHQvUVKrjUp6lXpJxJU,9143
|
|
34
34
|
nui_shared_utils/lambda_helpers.py,sha256=psHVotpmOfnmyQCoOt4MSIEj7VwWcy6gZM3vYSZwjOk,3041
|
|
35
35
|
nui_shared_utils/log_processors.py,sha256=x5gz1LEkbmoMCZ3ZB6q-mbn26dSzwh1trz4wSkBGxqk,5538
|
|
36
36
|
nui_shared_utils/powertools_helpers.py,sha256=pVu9MVBC6PEirHBbMC-9nKreP9jk8wd0fQt6OWekzdk,10126
|
|
37
|
-
nui_shared_utils/secrets_helper.py,sha256=
|
|
37
|
+
nui_shared_utils/secrets_helper.py,sha256=KoEKplGjfxc8HnhRXvxCRAqLKOOBN9oxKABjTlZvy4I,6806
|
|
38
38
|
nui_shared_utils/slack_client.py,sha256=_qR7Q1GU7gvYhUxiaBxEohhoEYznqr8kz9enGfeDtn8,24759
|
|
39
39
|
nui_shared_utils/slack_formatter.py,sha256=95g6XfAJst7RVhd0M0ahiF3gWWW5j96WYkCg5tLS6Zg,10894
|
|
40
40
|
nui_shared_utils/timezone.py,sha256=TvtSZV7w3Vvz3NbMTcJSNbUf0ZxPwpFS-xfgye1h-4Q,3583
|
|
@@ -43,8 +43,8 @@ nui_shared_utils/slack_setup/__init__.py,sha256=OElyS3xk4F_YKH5uUUTDpN0ah1dOO3e5
|
|
|
43
43
|
nui_shared_utils/slack_setup/channel_creator.py,sha256=0gyCBIS0EC96SVn1Z2dD4Fpzk0xNdHSWyiCxoUQIUe8,10667
|
|
44
44
|
nui_shared_utils/slack_setup/channel_definitions.py,sha256=atfz5ZhpqefOeLh1gShbWd-TLzgjPmhv95bfuTdmZog,5676
|
|
45
45
|
nui_shared_utils/slack_setup/setup_helpers.py,sha256=pzzXMs12GI9sdZttWeYzgLPgC0xqPz7ZLHM1GUPNNXc,7219
|
|
46
|
-
nui_python_shared_utils-1.3.
|
|
47
|
-
nui_python_shared_utils-1.3.
|
|
48
|
-
nui_python_shared_utils-1.3.
|
|
49
|
-
nui_python_shared_utils-1.3.
|
|
50
|
-
nui_python_shared_utils-1.3.
|
|
46
|
+
nui_python_shared_utils-1.3.2.dist-info/METADATA,sha256=-N4PxQPpnnqdwBjiZ-uCWfVdAgeYARr7tRfcXsoUuto,19387
|
|
47
|
+
nui_python_shared_utils-1.3.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
48
|
+
nui_python_shared_utils-1.3.2.dist-info/entry_points.txt,sha256=TrJ3Z4kz3oXfy6InXn20jHu7rnTwo-4EA0KRFX3fkL0,66
|
|
49
|
+
nui_python_shared_utils-1.3.2.dist-info/top_level.txt,sha256=sNceq5okmEB54L-gm4a0OgGhnPlU62zYmlUoXKn-Fa8,41
|
|
50
|
+
nui_python_shared_utils-1.3.2.dist-info/RECORD,,
|
nui_shared_utils/es_client.py
CHANGED
|
@@ -52,14 +52,14 @@ class ElasticsearchClient(BaseClient, ServiceHealthMixin):
|
|
|
52
52
|
def _resolve_credentials_from_env(self) -> Optional[Dict[str, Any]]:
|
|
53
53
|
"""Resolve Elasticsearch credentials from environment variables.
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
Accepts both conventions: ES_PASSWORD/ES_USERNAME and ES_PASS/ES_USER.
|
|
56
|
+
Password is required to trigger. Username defaults to "elastic".
|
|
57
57
|
"""
|
|
58
|
-
password = os.environ.get("ES_PASSWORD")
|
|
58
|
+
password = os.environ.get("ES_PASSWORD") or os.environ.get("ES_PASS")
|
|
59
59
|
if not password:
|
|
60
60
|
return None
|
|
61
61
|
return {
|
|
62
|
-
"username": os.environ.get("ES_USERNAME"
|
|
62
|
+
"username": os.environ.get("ES_USERNAME") or os.environ.get("ES_USER") or "elastic",
|
|
63
63
|
"password": password,
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -112,13 +112,29 @@ def get_elasticsearch_credentials(secret_name: Optional[str] = None) -> Dict:
|
|
|
112
112
|
"""
|
|
113
113
|
Get Elasticsearch credentials.
|
|
114
114
|
|
|
115
|
+
Precedence (matching BaseServiceClient pattern):
|
|
116
|
+
1. Environment variables (ES_PASSWORD/ES_PASS + ES_USERNAME/ES_USER)
|
|
117
|
+
2. AWS Secrets Manager
|
|
118
|
+
|
|
115
119
|
Args:
|
|
116
|
-
secret_name: Override default
|
|
120
|
+
secret_name: Override default secret name for Secrets Manager lookup.
|
|
121
|
+
Ignored when credentials are resolved from environment variables.
|
|
117
122
|
|
|
118
123
|
Returns:
|
|
119
124
|
Dict with host, username, password
|
|
120
125
|
"""
|
|
121
126
|
config = get_config()
|
|
127
|
+
|
|
128
|
+
# Environment variables first (local dev, CLI usage)
|
|
129
|
+
es_password = os.environ.get("ES_PASSWORD") or os.environ.get("ES_PASS")
|
|
130
|
+
if es_password:
|
|
131
|
+
es_user = os.environ.get("ES_USERNAME") or os.environ.get("ES_USER") or "elastic"
|
|
132
|
+
host = os.environ.get("ES_HOST") or config.es_host
|
|
133
|
+
if ":" not in host and not host.startswith("http"):
|
|
134
|
+
host = f"{host}:9200"
|
|
135
|
+
return {"host": host, "username": es_user, "password": es_password}
|
|
136
|
+
|
|
137
|
+
# Secrets Manager (Lambda runtime)
|
|
122
138
|
secret = secret_name or os.environ.get("ES_CREDENTIALS_SECRET") or config.es_credentials_secret
|
|
123
139
|
if not secret:
|
|
124
140
|
raise ValueError("No Elasticsearch secret name provided")
|
|
File without changes
|
{nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{nui_python_shared_utils-1.3.1.dist-info → nui_python_shared_utils-1.3.2.dist-info}/top_level.txt
RENAMED
|
File without changes
|