telert 0.2.4__tar.gz → 0.2.6__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.
Files changed (28) hide show
  1. {telert-0.2.4/telert.egg-info → telert-0.2.6}/PKG-INFO +2 -2
  2. {telert-0.2.4 → telert-0.2.6}/README.md +1 -1
  3. {telert-0.2.4 → telert-0.2.6}/pyproject.toml +1 -1
  4. {telert-0.2.4 → telert-0.2.6}/telert/__init__.py +4 -2
  5. {telert-0.2.4 → telert-0.2.6}/telert/api.py +75 -0
  6. {telert-0.2.4 → telert-0.2.6}/telert/cli.py +50 -7
  7. {telert-0.2.4 → telert-0.2.6}/telert/messaging.py +16 -0
  8. {telert-0.2.4 → telert-0.2.6/telert.egg-info}/PKG-INFO +2 -2
  9. {telert-0.2.4 → telert-0.2.6}/LICENSE +0 -0
  10. {telert-0.2.4 → telert-0.2.6}/MANIFEST.in +0 -0
  11. {telert-0.2.4 → telert-0.2.6}/setup.cfg +0 -0
  12. {telert-0.2.4 → telert-0.2.6}/telert/data/notification-icon.png +0 -0
  13. {telert-0.2.4 → telert-0.2.6}/telert/data/notification.mp3 +0 -0
  14. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/__init__.py +0 -0
  15. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/activity_logs.py +0 -0
  16. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/base.py +0 -0
  17. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/cli.py +0 -0
  18. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/cli_logs.py +0 -0
  19. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/debug_logs.py +0 -0
  20. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/log.py +0 -0
  21. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/network.py +0 -0
  22. {telert-0.2.4 → telert-0.2.6}/telert/monitoring/process.py +0 -0
  23. {telert-0.2.4 → telert-0.2.6}/telert.egg-info/SOURCES.txt +0 -0
  24. {telert-0.2.4 → telert-0.2.6}/telert.egg-info/dependency_links.txt +0 -0
  25. {telert-0.2.4 → telert-0.2.6}/telert.egg-info/entry_points.txt +0 -0
  26. {telert-0.2.4 → telert-0.2.6}/telert.egg-info/requires.txt +0 -0
  27. {telert-0.2.4 → telert-0.2.6}/telert.egg-info/top_level.txt +0 -0
  28. {telert-0.2.4 → telert-0.2.6}/telert.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telert
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Ultimate command monitoring & notification system: Telegram, Slack, Discord, Teams, Pushover, Email, desktop & more. Monitor Python code and CLI tasks with context managers, decorators, and webhooks.
5
5
  Author-email: Mihir Khandekar <mihirkhandekar@gmail.com>
6
6
  License-Expression: MIT
@@ -54,7 +54,7 @@ Dynamic: license-file
54
54
  <img src="https://github.com/navig-me/telert/raw/main/telert.png" alt="telert logo" width="150">
55
55
  </p>
56
56
 
57
- **Version 0.2.4**
57
+ **Version 0.2.6**
58
58
 
59
59
  [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
60
60
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
@@ -6,7 +6,7 @@
6
6
  <img src="https://github.com/navig-me/telert/raw/main/telert.png" alt="telert logo" width="150">
7
7
  </p>
8
8
 
9
- **Version 0.2.4**
9
+ **Version 0.2.6**
10
10
 
11
11
  [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
12
12
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telert"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "Ultimate command monitoring & notification system: Telegram, Slack, Discord, Teams, Pushover, Email, desktop & more. Monitor Python code and CLI tasks with context managers, decorators, and webhooks."
5
5
  authors = [{name = "Mihir Khandekar", email = "mihirkhandekar@gmail.com"}]
6
6
  license = "MIT"
@@ -12,6 +12,7 @@ __all__ = [
12
12
  "configure_audio",
13
13
  "configure_desktop",
14
14
  "configure_pushover",
15
+ "configure_endpoint",
15
16
  "configure_providers",
16
17
  "get_config",
17
18
  "is_configured",
@@ -19,19 +20,20 @@ __all__ = [
19
20
  "set_default_providers",
20
21
  "list_providers",
21
22
  ]
22
- __version__ = "0.2.4"
23
+ __version__ = "0.2.6"
23
24
 
24
25
  from telert.api import (
25
26
  configure,
26
27
  configure_audio,
27
28
  configure_desktop,
28
29
  configure_discord,
30
+ configure_email,
31
+ configure_endpoint,
29
32
  configure_providers,
30
33
  configure_pushover,
31
34
  configure_slack,
32
35
  configure_teams,
33
36
  configure_telegram,
34
- configure_email,
35
37
  get_config,
36
38
  is_configured,
37
39
  list_providers,
@@ -203,6 +203,56 @@ def configure_discord(webhook_url: str, username: Optional[str] = None, avatar_u
203
203
  configure_provider(Provider.DISCORD, **config)
204
204
 
205
205
 
206
+ def configure_endpoint(
207
+ url: str,
208
+ method: str = "POST",
209
+ headers: Optional[Dict[str, str]] = None,
210
+ payload_template: Optional[str] = None,
211
+ name: str = "Custom Endpoint",
212
+ timeout: int = 20,
213
+ set_default: bool = True,
214
+ ) -> None:
215
+ """
216
+ Configure Telert for custom HTTP endpoint notifications.
217
+
218
+ Args:
219
+ url: The URL to send notifications to (supports placeholders like {message}, {status_code}, {duration_seconds})
220
+ method: HTTP method to use (default: "POST")
221
+ headers: Optional dictionary of HTTP headers
222
+ payload_template: JSON payload template with placeholders (default: '{"text": "{message}"}')
223
+ name: Friendly name for this endpoint (default: "Custom Endpoint")
224
+ timeout: Request timeout in seconds (default: 20)
225
+ set_default: Whether to set Endpoint as the default provider
226
+
227
+ Examples:
228
+ from telert import configure_endpoint
229
+
230
+ # Basic configuration
231
+ configure_endpoint("https://api.example.com/webhook")
232
+
233
+ # Advanced configuration with custom headers and payload
234
+ configure_endpoint(
235
+ url="https://api.example.com/notifications",
236
+ method="POST",
237
+ headers={"Authorization": "Bearer token123", "Content-Type": "application/json"},
238
+ payload_template='{"alert": "{message}", "timestamp": "{timestamp}"}',
239
+ name="My API",
240
+ timeout=30
241
+ )
242
+ """
243
+ config = {
244
+ "url": url,
245
+ "method": method,
246
+ "headers": headers or {},
247
+ "payload_template": payload_template or '{"text": "{message}"}',
248
+ "name": name,
249
+ "timeout": timeout,
250
+ "set_default": set_default,
251
+ }
252
+
253
+ configure_provider(Provider.ENDPOINT, **config)
254
+
255
+
206
256
  def configure_email(
207
257
  server: str,
208
258
  port: int,
@@ -210,6 +260,8 @@ def configure_email(
210
260
  password: str,
211
261
  from_addr: str,
212
262
  to_addrs: List[str],
263
+ subject_template: Optional[str] = None,
264
+ use_html: bool = False,
213
265
  set_default: bool = True,
214
266
  ) -> None:
215
267
  """
@@ -222,11 +274,14 @@ def configure_email(
222
274
  password: The SMTP server password
223
275
  from_addr: The sender email address
224
276
  to_addrs: The recipient email addresses
277
+ subject_template: Template for email subject line with placeholders like {label} and {status}
278
+ use_html: Whether to send HTML formatted emails
225
279
  set_default: Whether to set Email as the default provider
226
280
 
227
281
  Examples:
228
282
  from telert import configure_email
229
283
 
284
+ # Basic configuration
230
285
  configure_email(
231
286
  "smtp.example.com",
232
287
  587,
@@ -236,6 +291,19 @@ def configure_email(
236
291
  ["to@example.com"],
237
292
  set_default=True
238
293
  )
294
+
295
+ # Advanced configuration with custom subject and HTML support
296
+ configure_email(
297
+ "smtp.example.com",
298
+ 587,
299
+ "user@example.com",
300
+ "password",
301
+ "from@example.com",
302
+ ["to@example.com"],
303
+ subject_template="Alert: {label} - {status}",
304
+ use_html=True,
305
+ set_default=True
306
+ )
239
307
  """
240
308
  config = {
241
309
  "server": server,
@@ -246,6 +314,13 @@ def configure_email(
246
314
  "to_addrs": to_addrs,
247
315
  "set_default": set_default,
248
316
  }
317
+
318
+ if subject_template is not None:
319
+ config["subject_template"] = subject_template
320
+
321
+ if use_html:
322
+ config["use_html"] = use_html
323
+
249
324
  configure_provider(Provider.EMAIL, **config)
250
325
 
251
326
 
@@ -104,6 +104,29 @@ def do_config(a):
104
104
  # Exit the function since we're done
105
105
  return
106
106
 
107
+ # List providers
108
+ if provider == "list-providers":
109
+ config = MessagingConfig()
110
+ providers = config.get_providers()
111
+ default_providers = config.get_default_providers()
112
+ print("Providers:")
113
+ if not providers:
114
+ print(" (none configured)")
115
+ return
116
+
117
+ for provider in providers:
118
+ if provider in default_providers:
119
+ if len(default_providers) > 1:
120
+ # Show priority order starting at 1
121
+ priority = default_providers.index(provider) + 1
122
+ marker = f" (default #{priority})"
123
+ else:
124
+ marker = " (default)"
125
+ else:
126
+ marker = ""
127
+ print(f" {provider.value}{marker}")
128
+ return
129
+
107
130
  # Single provider configuration
108
131
  if provider == "discord":
109
132
  if not hasattr(a, "webhook_url"):
@@ -291,8 +314,27 @@ def do_config(a):
291
314
  else:
292
315
  sys.exit(f"❌ Unknown provider: {provider}")
293
316
  else:
294
- # Legacy Telegram-only config for backward compatibility
295
- _save(a.token, a.chat_id)
317
+ print("Run `telert config --help` to see available options.\n")
318
+ config = MessagingConfig()
319
+ providers = config.get_providers()
320
+ default_providers = config.get_default_providers()
321
+ print("Providers:")
322
+ if not providers:
323
+ print(" (none configured)")
324
+ return
325
+
326
+ for provider in providers:
327
+ if provider in default_providers:
328
+ if len(default_providers) > 1:
329
+ # Show priority order starting at 1
330
+ priority = default_providers.index(provider) + 1
331
+ marker = f" (default #{priority})"
332
+ else:
333
+ marker = " (default)"
334
+ else:
335
+ marker = ""
336
+ print(f" {provider.value}{marker}")
337
+ return
296
338
 
297
339
 
298
340
  def do_status(a):
@@ -1412,7 +1454,7 @@ def main():
1412
1454
  dest="provider", help="provider type to configure"
1413
1455
  )
1414
1456
 
1415
- # Set defaults command (new)
1457
+ # Set defaults command
1416
1458
  set_defaults_parser = config_sp.add_parser(
1417
1459
  "set-defaults", help="set multiple default providers in priority order"
1418
1460
  )
@@ -1422,6 +1464,11 @@ def main():
1422
1464
  help="comma-separated list of providers to use as defaults, in priority order",
1423
1465
  )
1424
1466
 
1467
+ # List providers command
1468
+ list_providers_parser = config_sp.add_parser(
1469
+ "list-providers", help="list all available providers"
1470
+ )
1471
+
1425
1472
  # Telegram config
1426
1473
  telegram_parser = config_sp.add_parser(
1427
1474
  "telegram", help="configure Telegram messaging"
@@ -1627,10 +1674,6 @@ def main():
1627
1674
  help="add to existing default providers",
1628
1675
  )
1629
1676
 
1630
- # Legacy Telegram config (for backward compatibility)
1631
- c.add_argument("--token", help="(legacy) Telegram bot token")
1632
- c.add_argument("--chat-id", help="(legacy) Telegram chat ID")
1633
-
1634
1677
  c.set_defaults(func=do_config)
1635
1678
 
1636
1679
  # status
@@ -227,6 +227,22 @@ class MessagingConfig:
227
227
  """Check if a provider is configured."""
228
228
  return bool(self.get_provider_config(provider))
229
229
 
230
+ def get_providers(self) -> List[Provider]:
231
+ """Return a list of all providers that are configured.
232
+
233
+ A provider is considered configured if configuration exists in the
234
+ configuration file or corresponding environment variables.
235
+ """
236
+ configured: List[Provider] = []
237
+ for p in Provider:
238
+ try:
239
+ if self.is_provider_configured(p):
240
+ configured.append(p)
241
+ except Exception:
242
+ # Ignore any provider-specific errors when checking configuration
243
+ pass
244
+ return configured
245
+
230
246
  def get_default_providers(self) -> List[Provider]:
231
247
  """Get the default providers if configured.
232
248
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telert
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Ultimate command monitoring & notification system: Telegram, Slack, Discord, Teams, Pushover, Email, desktop & more. Monitor Python code and CLI tasks with context managers, decorators, and webhooks.
5
5
  Author-email: Mihir Khandekar <mihirkhandekar@gmail.com>
6
6
  License-Expression: MIT
@@ -54,7 +54,7 @@ Dynamic: license-file
54
54
  <img src="https://github.com/navig-me/telert/raw/main/telert.png" alt="telert logo" width="150">
55
55
  </p>
56
56
 
57
- **Version 0.2.4**
57
+ **Version 0.2.6**
58
58
 
59
59
  [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
60
60
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes