
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
py-telegram-notifier
Advanced tools
A tool using the Telegram Bot API for sending messages to a Telegram chat by a context manager, function call, or CLI.
A tool using the Telegram Bot API for sending messages to a Telegram chat by a context manager, function call, or CLI.
The purpose of this module is to provide a simple way to send messages to a Telegram chat using the Telegram Bot API. This is especially useful for long-running automation scripts, where the user may not be around to check the logs.
This is not a wrapper for the Telegram Bot API, but rather a utility for notifying users of enter/exit events with a context manager.
pip install py-telegram-notifier
In order for the module to function, you must supply it with a bot token and a chat id. Full instructions on creating a bot can be found here.
Firstly, set up the config for your Notifier. Bot token and chat id are required and must be set as environment
variables (TELEGRAM_TOKEN
and TELEGRAM_CHAT_ID
, respectively). It's strongly recommended to use a git-ignored .env
file for this purpose, an example file can be found here.
import dotenv
from telegram_notifier import Notifier
# Load environment variables
dotenv.load_dotenv()
with Notifier("Test case") as notifier:
# Enter message fired
notifier.send_message("This is a progress update")
# Exit message fired
import dotenv
from telegram_notifier import Notifier
# Load environment variables
dotenv.load_dotenv()
notifier = Notifier()
notifier.send_message("Test message")
# Does not need to be used as a context manager
TELEGRAM_TOKEN=0000000000 TELEGRAM_CHAT_ID=0000000000 python -m telegram_notifier "Test message"
This module treats all messages as MarkdownV2
by default, and escapes known reserved characters. See Notifier.send_message()
for more information.
The author of this software is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Telegram or any of its affiliates and is independently owned and created.
FAQs
A tool using the Telegram Bot API for sending messages to a Telegram chat by a context manager, function call, or CLI.
We found that py-telegram-notifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.