telert 0.2.2__tar.gz → 0.2.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.
Files changed (28) hide show
  1. {telert-0.2.2/telert.egg-info → telert-0.2.4}/PKG-INFO +14 -4
  2. {telert-0.2.2 → telert-0.2.4}/README.md +13 -3
  3. {telert-0.2.2 → telert-0.2.4}/pyproject.toml +1 -1
  4. {telert-0.2.2 → telert-0.2.4}/telert/__init__.py +1 -1
  5. {telert-0.2.2 → telert-0.2.4}/telert/cli.py +3 -1
  6. {telert-0.2.2 → telert-0.2.4}/telert/messaging.py +79 -17
  7. {telert-0.2.2 → telert-0.2.4/telert.egg-info}/PKG-INFO +14 -4
  8. {telert-0.2.2 → telert-0.2.4}/LICENSE +0 -0
  9. {telert-0.2.2 → telert-0.2.4}/MANIFEST.in +0 -0
  10. {telert-0.2.2 → telert-0.2.4}/setup.cfg +0 -0
  11. {telert-0.2.2 → telert-0.2.4}/telert/api.py +0 -0
  12. {telert-0.2.2 → telert-0.2.4}/telert/data/notification-icon.png +0 -0
  13. {telert-0.2.2 → telert-0.2.4}/telert/data/notification.mp3 +0 -0
  14. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/__init__.py +0 -0
  15. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/activity_logs.py +0 -0
  16. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/base.py +0 -0
  17. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/cli.py +0 -0
  18. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/cli_logs.py +0 -0
  19. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/debug_logs.py +0 -0
  20. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/log.py +0 -0
  21. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/network.py +0 -0
  22. {telert-0.2.2 → telert-0.2.4}/telert/monitoring/process.py +0 -0
  23. {telert-0.2.2 → telert-0.2.4}/telert.egg-info/SOURCES.txt +0 -0
  24. {telert-0.2.2 → telert-0.2.4}/telert.egg-info/dependency_links.txt +0 -0
  25. {telert-0.2.2 → telert-0.2.4}/telert.egg-info/entry_points.txt +0 -0
  26. {telert-0.2.2 → telert-0.2.4}/telert.egg-info/requires.txt +0 -0
  27. {telert-0.2.2 → telert-0.2.4}/telert.egg-info/top_level.txt +0 -0
  28. {telert-0.2.2 → telert-0.2.4}/telert.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telert
3
- Version: 0.2.2
3
+ Version: 0.2.4
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,11 +54,11 @@ 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.2**
57
+ **Version 0.2.4**
58
58
 
59
+ [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
59
60
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
60
61
  [![PyPI version](https://img.shields.io/pypi/v/telert)](https://pypi.org/project/telert/)
61
- [![Downloads](https://static.pepy.tech/personalized-badge/telert?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/telert)
62
62
  [![License](https://img.shields.io/github/license/navig-me/telert)](https://github.com/navig-me/telert/blob/main/LICENSE)
63
63
  [![Marketplace](https://img.shields.io/badge/GitHub%20Marketplace-Use%20this%20Action-blue?logo=github)](https://github.com/marketplace/actions/telert-run)
64
64
  [![VS Code Marketplace](https://vsmarketplacebadges.dev/version/Navig.telert-vscode.svg?subject=VS%20Code%20Marketplace&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=Navig.telert-vscode)
@@ -102,10 +102,14 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
102
102
  - As a cloud-hosted API on [Replit](https://replit.com/@mihir95/Telert-CLI-Notifier), [Railway](https://railway.com/template/A_kYXt?referralCode=vj4bEA), [Render](https://render.com/deploy?repo=https://github.com/navig-me/telert-notifier) or [Fly.io](https://github.com/navig-me/telert-notifier?tab=readme-ov-file#-deploy-manually-on-flyio) with one-click deployments.
103
103
 
104
104
 
105
- <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="600">
105
+ <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="700">
106
106
 
107
107
 
108
108
  ## 📋 Table of Contents
109
+
110
+ <details>
111
+ <summary> <b>View Table of Contents</b> </summary>
112
+
109
113
  - [Installation & Quick Start](#-installation--quick-start)
110
114
  - [Notification Providers](#-notification-providers)
111
115
  - [Telegram](#telegram-setup)
@@ -133,9 +137,13 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
133
137
  - [Message Formatting](#-message-formatting)
134
138
  - [Use Cases](#-use-cases-and-tips)
135
139
  - [Contributing](#-contributing--license)
140
+ </details>
136
141
 
137
142
  ## Documentation
138
143
 
144
+ <details>
145
+ <summary> <b>View Documentation Directory</b></summary>
146
+
139
147
  For more detailed information, please refer to the [docs](https://github.com/navig-me/telert/blob/main/docs/) directory:
140
148
 
141
149
  - [Environment Variables](https://github.com/navig-me/telert/blob/main/docs/ENVIRONMENT_VARIABLES.md)
@@ -153,6 +161,8 @@ For more detailed information, please refer to the [docs](https://github.com/nav
153
161
  - [Docker Usage](https://github.com/navig-me/telert/blob/main/docs/DOCKER.md)
154
162
  - [CI/CD Integrations](https://github.com/navig-me/telert/blob/main/docs/CI-CD.md)
155
163
 
164
+ </details>
165
+
156
166
  ## 🚀 Installation & Quick Start
157
167
 
158
168
  Install and configure in seconds:
@@ -6,11 +6,11 @@
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.2**
9
+ **Version 0.2.4**
10
10
 
11
+ [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
11
12
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
12
13
  [![PyPI version](https://img.shields.io/pypi/v/telert)](https://pypi.org/project/telert/)
13
- [![Downloads](https://static.pepy.tech/personalized-badge/telert?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/telert)
14
14
  [![License](https://img.shields.io/github/license/navig-me/telert)](https://github.com/navig-me/telert/blob/main/LICENSE)
15
15
  [![Marketplace](https://img.shields.io/badge/GitHub%20Marketplace-Use%20this%20Action-blue?logo=github)](https://github.com/marketplace/actions/telert-run)
16
16
  [![VS Code Marketplace](https://vsmarketplacebadges.dev/version/Navig.telert-vscode.svg?subject=VS%20Code%20Marketplace&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=Navig.telert-vscode)
@@ -54,10 +54,14 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
54
54
  - As a cloud-hosted API on [Replit](https://replit.com/@mihir95/Telert-CLI-Notifier), [Railway](https://railway.com/template/A_kYXt?referralCode=vj4bEA), [Render](https://render.com/deploy?repo=https://github.com/navig-me/telert-notifier) or [Fly.io](https://github.com/navig-me/telert-notifier?tab=readme-ov-file#-deploy-manually-on-flyio) with one-click deployments.
55
55
 
56
56
 
57
- <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="600">
57
+ <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="700">
58
58
 
59
59
 
60
60
  ## 📋 Table of Contents
61
+
62
+ <details>
63
+ <summary> <b>View Table of Contents</b> </summary>
64
+
61
65
  - [Installation & Quick Start](#-installation--quick-start)
62
66
  - [Notification Providers](#-notification-providers)
63
67
  - [Telegram](#telegram-setup)
@@ -85,9 +89,13 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
85
89
  - [Message Formatting](#-message-formatting)
86
90
  - [Use Cases](#-use-cases-and-tips)
87
91
  - [Contributing](#-contributing--license)
92
+ </details>
88
93
 
89
94
  ## Documentation
90
95
 
96
+ <details>
97
+ <summary> <b>View Documentation Directory</b></summary>
98
+
91
99
  For more detailed information, please refer to the [docs](https://github.com/navig-me/telert/blob/main/docs/) directory:
92
100
 
93
101
  - [Environment Variables](https://github.com/navig-me/telert/blob/main/docs/ENVIRONMENT_VARIABLES.md)
@@ -105,6 +113,8 @@ For more detailed information, please refer to the [docs](https://github.com/nav
105
113
  - [Docker Usage](https://github.com/navig-me/telert/blob/main/docs/DOCKER.md)
106
114
  - [CI/CD Integrations](https://github.com/navig-me/telert/blob/main/docs/CI-CD.md)
107
115
 
116
+ </details>
117
+
108
118
  ## 🚀 Installation & Quick Start
109
119
 
110
120
  Install and configure in seconds:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telert"
3
- version = "0.2.2"
3
+ version = "0.2.4"
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"
@@ -19,7 +19,7 @@ __all__ = [
19
19
  "set_default_providers",
20
20
  "list_providers",
21
21
  ]
22
- __version__ = "0.2.2"
22
+ __version__ = "0.2.4"
23
23
 
24
24
  from telert.api import (
25
25
  configure,
@@ -919,7 +919,6 @@ def piped_mode():
919
919
 
920
920
  def do_init(a):
921
921
  """Run the interactive configuration wizard."""
922
- config = MessagingConfig()
923
922
 
924
923
  print("\n🔔 Welcome to telert configuration wizard! 🔔")
925
924
  print("This wizard will help you set up notification providers.\n")
@@ -1286,6 +1285,9 @@ def do_init(a):
1286
1285
  except Exception as e:
1287
1286
  print(f"❌ Failed to configure email: {str(e)}")
1288
1287
 
1288
+ # Reload configuration after provider setup to ensure we have the latest state
1289
+ config = MessagingConfig()
1290
+
1289
1291
  # Set default providers if any were configured successfully
1290
1292
  if selected_providers:
1291
1293
  # Step 2: Set defaults and order
@@ -337,7 +337,11 @@ def prepare_telegram_html(message: str) -> str:
337
337
  # Process all elements recursively
338
338
  def process_node(node):
339
339
  if node.name is None: # Text node
340
- return node.string
340
+ # Escape HTML special characters in text content
341
+ text = node.string or ""
342
+ # HTML mode requires escaping of <, >, & characters
343
+ text = text.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
344
+ return text
341
345
 
342
346
  # Only include supported tags, strip others but keep their content
343
347
  supported_tags = ['b', 'i', 'u', 's', 'code', 'pre', 'a']
@@ -361,6 +365,25 @@ def prepare_telegram_html(message: str) -> str:
361
365
  return result
362
366
 
363
367
 
368
+ def prepare_telegram_plain_text(message: str) -> str:
369
+ """
370
+ Return the message unchanged for plain-text Telegram delivery.
371
+
372
+ When *no* ``parse_mode`` is supplied the Telegram Bot API treats the text as
373
+ raw UTF-8. Therefore no additional character escaping is required – adding
374
+ back-slashes would make the message look cluttered (e.g. ``\(`` and
375
+ ``\)``). We simply return the original message so that it appears exactly
376
+ as passed by the caller.
377
+
378
+ Args:
379
+ message: Message text to send as-is.
380
+
381
+ Returns:
382
+ The unmodified message string.
383
+ """
384
+ return message
385
+
386
+
364
387
  def prepare_telegram_markdown(message: str) -> str:
365
388
  """
366
389
  Prepare Markdown-formatted messages for Telegram.
@@ -380,29 +403,65 @@ def prepare_telegram_markdown(message: str) -> str:
380
403
  # Characters that need to be escaped in MarkdownV2
381
404
  special_chars = ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
382
405
 
383
- # We need to escape these characters outside of formatting tags
406
+ # For MarkdownV2, we need to escape special characters but preserve markdown syntax
407
+ # This is a simplified approach - for complex markdown, consider using a proper parser
384
408
  result = ""
385
- in_tag = False
386
409
  i = 0
387
410
 
388
411
  while i < len(message):
389
- # Check for formatting tags
390
- if message[i:i+2] in ['**', '__'] or message[i] in ['*', '_', '`', '~']:
391
- # Toggle in_tag state
392
- in_tag = not in_tag
393
- result += message[i]
412
+ char = message[i]
413
+
414
+ # Handle code blocks (``` or single `)
415
+ if char == '`':
416
+ # Find the matching closing backtick(s)
417
+ if i + 2 < len(message) and message[i:i+3] == '```':
418
+ # Code block - find closing ```
419
+ end = message.find('```', i + 3)
420
+ if end != -1:
421
+ # Include the entire code block without escaping
422
+ result += message[i:end+3]
423
+ i = end + 3
424
+ continue
425
+ else:
426
+ # Inline code - find closing `
427
+ end = message.find('`', i + 1)
428
+ if end != -1:
429
+ # Include the entire inline code without escaping
430
+ result += message[i:end+1]
431
+ i = end + 1
432
+ continue
433
+
434
+ # Handle other markdown formatting characters
435
+ if char in ['*', '_', '~'] and i + 1 < len(message):
436
+ # Check for double characters (**, __, etc.)
394
437
  if message[i:i+2] in ['**', '__']:
395
- result += message[i+1]
396
- i += 2
438
+ # Find matching closing tag
439
+ tag = message[i:i+2]
440
+ end = message.find(tag, i + 2)
441
+ if end != -1:
442
+ # Include the formatted text, escaping content inside
443
+ content = message[i+2:end]
444
+ escaped_content = ''.join('\\' + c if c in special_chars and c not in ['*', '_'] else c for c in content)
445
+ result += tag + escaped_content + tag
446
+ i = end + 2
447
+ continue
397
448
  else:
398
- i += 1
449
+ # Single character formatting
450
+ end = message.find(char, i + 1)
451
+ if end != -1:
452
+ # Include the formatted text, escaping content inside
453
+ content = message[i+1:end]
454
+ escaped_content = ''.join('\\' + c if c in special_chars and c != char else c for c in content)
455
+ result += char + escaped_content + char
456
+ i = end + 1
457
+ continue
458
+
459
+ # Regular character - escape if it's a special character
460
+ if char in special_chars:
461
+ result += '\\' + char
399
462
  else:
400
- # Escape special characters outside of formatting tags
401
- if not in_tag and message[i] in special_chars:
402
- result += '\\' + message[i]
403
- else:
404
- result += message[i]
405
- i += 1
463
+ result += char
464
+ i += 1
406
465
 
407
466
  return result
408
467
 
@@ -486,6 +545,9 @@ class TelegramProvider:
486
545
  elif has_markdown:
487
546
  payload["parse_mode"] = "MarkdownV2"
488
547
  payload["text"] = prepare_telegram_markdown(message)
548
+ else:
549
+ # Plain text - escape special characters to prevent API errors
550
+ payload["text"] = prepare_telegram_plain_text(message)
489
551
 
490
552
  try:
491
553
  response = requests.post(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telert
3
- Version: 0.2.2
3
+ Version: 0.2.4
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,11 +54,11 @@ 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.2**
57
+ **Version 0.2.4**
58
58
 
59
+ [![PyPI Downloads](https://static.pepy.tech/badge/telert)](https://pepy.tech/projects/telert)
59
60
  [![GitHub Stars](https://img.shields.io/github/stars/navig-me/telert?style=social)](https://github.com/navig-me/telert/stargazers)
60
61
  [![PyPI version](https://img.shields.io/pypi/v/telert)](https://pypi.org/project/telert/)
61
- [![Downloads](https://static.pepy.tech/personalized-badge/telert?period=month&units=international_system&left_color=grey&right_color=blue&left_text=downloads)](https://pepy.tech/project/telert)
62
62
  [![License](https://img.shields.io/github/license/navig-me/telert)](https://github.com/navig-me/telert/blob/main/LICENSE)
63
63
  [![Marketplace](https://img.shields.io/badge/GitHub%20Marketplace-Use%20this%20Action-blue?logo=github)](https://github.com/marketplace/actions/telert-run)
64
64
  [![VS Code Marketplace](https://vsmarketplacebadges.dev/version/Navig.telert-vscode.svg?subject=VS%20Code%20Marketplace&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=Navig.telert-vscode)
@@ -102,10 +102,14 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
102
102
  - As a cloud-hosted API on [Replit](https://replit.com/@mihir95/Telert-CLI-Notifier), [Railway](https://railway.com/template/A_kYXt?referralCode=vj4bEA), [Render](https://render.com/deploy?repo=https://github.com/navig-me/telert-notifier) or [Fly.io](https://github.com/navig-me/telert-notifier?tab=readme-ov-file#-deploy-manually-on-flyio) with one-click deployments.
103
103
 
104
104
 
105
- <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="600">
105
+ <img src="https://github.com/navig-me/telert/raw/main/docs/telert-demo.svg" alt="telert demo" width="700">
106
106
 
107
107
 
108
108
  ## 📋 Table of Contents
109
+
110
+ <details>
111
+ <summary> <b>View Table of Contents</b> </summary>
112
+
109
113
  - [Installation & Quick Start](#-installation--quick-start)
110
114
  - [Notification Providers](#-notification-providers)
111
115
  - [Telegram](#telegram-setup)
@@ -133,9 +137,13 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
133
137
  - [Message Formatting](#-message-formatting)
134
138
  - [Use Cases](#-use-cases-and-tips)
135
139
  - [Contributing](#-contributing--license)
140
+ </details>
136
141
 
137
142
  ## Documentation
138
143
 
144
+ <details>
145
+ <summary> <b>View Documentation Directory</b></summary>
146
+
139
147
  For more detailed information, please refer to the [docs](https://github.com/navig-me/telert/blob/main/docs/) directory:
140
148
 
141
149
  - [Environment Variables](https://github.com/navig-me/telert/blob/main/docs/ENVIRONMENT_VARIABLES.md)
@@ -153,6 +161,8 @@ For more detailed information, please refer to the [docs](https://github.com/nav
153
161
  - [Docker Usage](https://github.com/navig-me/telert/blob/main/docs/DOCKER.md)
154
162
  - [CI/CD Integrations](https://github.com/navig-me/telert/blob/main/docs/CI-CD.md)
155
163
 
164
+ </details>
165
+
156
166
  ## 🚀 Installation & Quick Start
157
167
 
158
168
  Install and configure in seconds:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes