bw-essentials-core 0.0.2__tar.gz → 0.0.4__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.

Files changed (30) hide show
  1. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/PKG-INFO +3 -2
  2. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/README.md +2 -1
  3. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/notifications/teams_notifications.py +12 -5
  4. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials_core.egg-info/PKG-INFO +3 -2
  5. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/setup.py +1 -1
  6. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/__init__.py +0 -0
  7. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/constants/__init__.py +0 -0
  8. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/constants/services.py +0 -0
  9. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/data_loch/__init__.py +0 -0
  10. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/data_loch/data_loch.py +0 -0
  11. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/email_client/__init__.py +0 -0
  12. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/email_client/email_client.py +0 -0
  13. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/notifications/__init__.py +0 -0
  14. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/notifications/teams_notification_schemas.py +0 -0
  15. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/s3_utils/__init__.py +0 -0
  16. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/s3_utils/s3_utils.py +0 -0
  17. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/__init__.py +0 -0
  18. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/api_client.py +0 -0
  19. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/broker.py +0 -0
  20. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/market_pricer.py +0 -0
  21. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/master_data.py +0 -0
  22. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/model_portfolio_reporting.py +0 -0
  23. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/trade_placement.py +0 -0
  24. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/user_portfolio.py +0 -0
  25. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials/services/user_portfolio_reporting.py +0 -0
  26. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials_core.egg-info/SOURCES.txt +0 -0
  27. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials_core.egg-info/dependency_links.txt +0 -0
  28. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials_core.egg-info/requires.txt +0 -0
  29. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/bw_essentials_core.egg-info/top_level.txt +0 -0
  30. {bw_essentials_core-0.0.2 → bw_essentials_core-0.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -177,7 +177,8 @@ from bw_essentials.notifications import Notifications
177
177
  notifier = Notifications(
178
178
  title="BW Alerts",
179
179
  summary="Pipeline Failure",
180
- message="Daily data sync failed."
180
+ message="Daily data sync failed.",
181
+ webhook_url="https://sample.webhook.url"
181
182
  )
182
183
  ```
183
184
 
@@ -151,7 +151,8 @@ from bw_essentials.notifications import Notifications
151
151
  notifier = Notifications(
152
152
  title="BW Alerts",
153
153
  summary="Pipeline Failure",
154
- message="Daily data sync failed."
154
+ message="Daily data sync failed.",
155
+ webhook_url="https://sample.webhook.url"
155
156
  )
156
157
  ```
157
158
 
@@ -30,6 +30,7 @@ class Notifications:
30
30
  alert (bool, optional): If True, it's treated as an error; otherwise as a log. Defaults to False.
31
31
  trace (str, optional): Optional traceback or detailed error string.
32
32
  request_id (str, optional): Optional correlation ID for tracing logs.
33
+ webhook_url(str, Optional): Optional webhook url for teams channel.
33
34
  """
34
35
 
35
36
  def __init__(self,
@@ -38,7 +39,8 @@ class Notifications:
38
39
  message=None,
39
40
  alert=False,
40
41
  trace=None,
41
- request_id=None):
42
+ request_id=None,
43
+ webhook_url=None):
42
44
  self.message = message
43
45
  self.title = title
44
46
  self.summary = summary
@@ -47,14 +49,15 @@ class Notifications:
47
49
  self.request_id = request_id
48
50
  self.notify_on_teams = self._get_env_var("NOTIFY_ON_TEAMS")
49
51
  self.notify_on_calls = self._get_env_var("NOTIFY_ON_CALLS")
50
- self.webhook_url = self._get_env_var("TEAMS_WEBHOOK_URL")
52
+ self.webhook_url = self._get_env_var("TEAMS_WEBHOOK_URL", webhook_url)
51
53
  self.zenduty_url = self._get_env_var("ZENDUTY_URL")
52
54
  self.api_timeout = self._get_env_var("API_TIMEOUT")
53
55
 
54
- def _get_env_var(self, key: str) -> str:
56
+ def _get_env_var(self, key: str, webhook_url: str = None) -> str:
55
57
  """
56
58
  Fetch a required variable from bw_config.py located in the root directory.
57
-
59
+ Args:
60
+ webhook_url(Optional[str]): Optional Teams webhook url at the time of initialisation.
58
61
  Raises:
59
62
  FileNotFoundError: If bw_config.py is not found.
60
63
  AttributeError: If the requested key is not defined in the config.
@@ -62,6 +65,9 @@ class Notifications:
62
65
  Returns:
63
66
  str: The value of the config variable.
64
67
  """
68
+ if webhook_url:
69
+ return webhook_url
70
+
65
71
  config_path = os.path.join(os.getcwd(), "bw_config.py")
66
72
 
67
73
  if not os.path.exists(config_path):
@@ -74,7 +80,8 @@ class Notifications:
74
80
  spec.loader.exec_module(bw_config)
75
81
 
76
82
  if not hasattr(bw_config, key):
77
- raise AttributeError(f"`{key}` not found in bw_config.py. Please define it in the config.")
83
+ raise AttributeError(f"`{key}` not found in bw_config.py. Please either define it in the config or"
84
+ f"pass it during Notifications init")
78
85
 
79
86
  return getattr(bw_config, key)
80
87
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bw-essentials-core
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Reusable utilities for S3, email, Data Loch, Microsoft Teams Notifications and more.
5
5
  Author: InvestorAI
6
6
  Author-email: support+tech@investorai.in
@@ -177,7 +177,8 @@ from bw_essentials.notifications import Notifications
177
177
  notifier = Notifications(
178
178
  title="BW Alerts",
179
179
  summary="Pipeline Failure",
180
- message="Daily data sync failed."
180
+ message="Daily data sync failed.",
181
+ webhook_url="https://sample.webhook.url"
181
182
  )
182
183
  ```
183
184
 
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages
10
10
 
11
11
  setup(
12
12
  name="bw-essentials-core",
13
- version="0.0.2",
13
+ version="0.0.4",
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.",