bw-essentials-core 0.1.0__tar.gz → 0.1.2__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 bw-essentials-core might be problematic. Click here for more details.
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/PKG-INFO +1 -1
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/data_loch/data_loch.py +16 -0
- bw_essentials_core-0.1.2/bw_essentials/services/notification.py +77 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/PKG-INFO +1 -1
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/SOURCES.txt +1 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/setup.py +1 -1
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/README.md +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/constants/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/constants/services.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/data_loch/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/email_client/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/email_client/email_client.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/notifications/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/notifications/teams_notifications.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/s3_utils/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/s3_utils/s3_utils.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/__init__.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/api_client.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/broker.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/market_pricer.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/master_data.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/model_portfolio_reporting.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/trade_placement.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/user_app.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/user_portfolio.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/user_portfolio_reporting.py +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/requires.txt +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/top_level.txt +0 -0
- {bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/setup.cfg +0 -0
|
@@ -279,3 +279,19 @@ class DataLoch:
|
|
|
279
279
|
prefix = f"{branch}/{server_path}"
|
|
280
280
|
self.s3.delete_files_by_prefix(repository, prefix)
|
|
281
281
|
logger.info(f"Deleted all files under prefix {prefix}")
|
|
282
|
+
|
|
283
|
+
def delete_single_file(self, repository: str, branch: str, server_path: str) -> None:
|
|
284
|
+
"""
|
|
285
|
+
Delete a single file at the specified path in a LakeFS branch.
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
repository (str): The name of the LakeFS repository.
|
|
289
|
+
branch (str): The name of the branch within the repository.
|
|
290
|
+
server_path (str): The file path (relative to the branch) to delete.
|
|
291
|
+
"""
|
|
292
|
+
full_path = f"{branch}/{server_path}"
|
|
293
|
+
logger.info(f"Attempting to delete file at path: {full_path} in repository: {repository}")
|
|
294
|
+
|
|
295
|
+
self.s3.delete_file(repository, full_path)
|
|
296
|
+
|
|
297
|
+
logger.info(f"Successfully deleted file: {full_path} from repository: {repository}")
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module to make API calls to Notification Service
|
|
3
|
+
"""
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
from bw_essentials.constants.services import Services
|
|
7
|
+
from bw_essentials.services.api_client import ApiClient
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class NotificationService(ApiClient):
|
|
13
|
+
"""
|
|
14
|
+
Handles notifications through various channels.
|
|
15
|
+
"""
|
|
16
|
+
PLATFORM = "PLATFORM"
|
|
17
|
+
NOTIFICATION_API_KEY = 'NOTIFICATION_API_KEY'
|
|
18
|
+
NOTIFICATION_SENDER_NUMBER = "NOTIFICATION_SENDER_NUMBER"
|
|
19
|
+
|
|
20
|
+
def __init__(self):
|
|
21
|
+
"""
|
|
22
|
+
Initializes the Notification object.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
- user: The user associated with the notification.
|
|
26
|
+
"""
|
|
27
|
+
super().__init__("notification")
|
|
28
|
+
self.name = Services.NOTIFICATION.value
|
|
29
|
+
self.base_url = self.get_base_url(self.name)
|
|
30
|
+
self.urls = {
|
|
31
|
+
"whatsapp": "whatsapp"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def _whatsapp(self, title, template, platform, params, to, user_id):
|
|
35
|
+
"""
|
|
36
|
+
Sends a WhatsApp notification.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
- user_id (str): The ID of the user receiving the notification.
|
|
40
|
+
- number (str): The phone number for the recipient.
|
|
41
|
+
- title (str): Title of the notification.
|
|
42
|
+
- template (str): Template for the WhatsApp message.
|
|
43
|
+
- platform (str): The platform used for sending
|
|
44
|
+
(WhatsApp, in this case).
|
|
45
|
+
- params: Parameters for the notification message.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
None
|
|
49
|
+
"""
|
|
50
|
+
logger.info(f"In - whatsapp {user_id =}, {to =}, "
|
|
51
|
+
f"{title =}, {template =}, {platform =}, {params =}")
|
|
52
|
+
payload = {
|
|
53
|
+
"from": self._get_env_var(NotificationService.NOTIFICATION_SENDER_NUMBER),
|
|
54
|
+
"to": to,
|
|
55
|
+
"userId": user_id,
|
|
56
|
+
"platform": platform,
|
|
57
|
+
"title": title,
|
|
58
|
+
"template": template,
|
|
59
|
+
"params": params
|
|
60
|
+
}
|
|
61
|
+
logger.info(f"whatsapp {payload =}")
|
|
62
|
+
headers = {
|
|
63
|
+
'api-key': self._get_env_var(NotificationService.NOTIFICATION_API_KEY)
|
|
64
|
+
}
|
|
65
|
+
self.set_headers(headers)
|
|
66
|
+
resp_data = self._post(url=self.base_url, endpoint=self.urls.get('whatsapp'), data=payload)
|
|
67
|
+
logger.info(f"Whatsapp response {resp_data =}")
|
|
68
|
+
|
|
69
|
+
def send_whatsapp(self, template, title, params, to, user_id):
|
|
70
|
+
logger.info(f"In - send_whatsapp_notification {user_id =} {title = } {params = } {to = }")
|
|
71
|
+
|
|
72
|
+
self._whatsapp(title=title,
|
|
73
|
+
template=template,
|
|
74
|
+
platform=self._get_env_var(NotificationService.PLATFORM),
|
|
75
|
+
params=params,
|
|
76
|
+
to=to,
|
|
77
|
+
user_id=user_id)
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/SOURCES.txt
RENAMED
|
@@ -18,6 +18,7 @@ bw_essentials/services/broker.py
|
|
|
18
18
|
bw_essentials/services/market_pricer.py
|
|
19
19
|
bw_essentials/services/master_data.py
|
|
20
20
|
bw_essentials/services/model_portfolio_reporting.py
|
|
21
|
+
bw_essentials/services/notification.py
|
|
21
22
|
bw_essentials/services/trade_placement.py
|
|
22
23
|
bw_essentials/services/user_app.py
|
|
23
24
|
bw_essentials/services/user_portfolio.py
|
|
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name="bw-essentials-core",
|
|
13
|
-
version="0.1.
|
|
13
|
+
version="0.1.2",
|
|
14
14
|
author="InvestorAI",
|
|
15
15
|
author_email="support+tech@investorai.in",
|
|
16
16
|
description="Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/email_client/__init__.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/email_client/email_client.py
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/notifications/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/market_pricer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/trade_placement.py
RENAMED
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials/services/user_portfolio.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{bw_essentials_core-0.1.0 → bw_essentials_core-0.1.2}/bw_essentials_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|