A simple notification library using Telegram bots
Project description
Telenotif
A simple Python library for sending notifications via Telegram bot when your long-running tasks complete.
Installation
pip install telenotif
Usage
from telenotif import notif
# Initialize with your bot token and user ID
# Both are strings
notifier = notif(BOT_TOKEN, USER_ID)
# Send a simple notification
for item in range(10000):
print(item)
notifier.alert("Loop finished")
# Or use it as a decorator
@notifier.decorator("Long process completed!")
def long_process():
for i in range(10000):
print(i)
# Run the function
long_process() # Will send notification when done
Getting Started
- Create a Telegram bot using @BotFather
- Get your bot token from BotFather
- Get your user ID by messaging @userinfobot
- Note that before the bot be able to message you must at least send the bot a message "Simply send a hello to your bot after creation."
Features
- Simple interface with
alert()method - Decorator support for automatic notifications
- Async support under the hood
- Error handling and logging
- Silent notifications option
- Credential validation on initialization
License
MIT License
LICENSE
MIT License
Copyright (c) 2024 Sina
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telenotif-0.1.1.tar.gz.
File metadata
- Download URL: telenotif-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db16ee82cda233d9291695e39baaaf4f4c55ac701a8a5fe040b4f2814247443d
|
|
| MD5 |
14260f9a6dd1de0c1bf9c5692219ee5d
|
|
| BLAKE2b-256 |
9891a0c95543910638af234619569574a0c071f370f25ba073c5e00343662ec2
|
File details
Details for the file telenotif-0.1.1-py3-none-any.whl.
File metadata
- Download URL: telenotif-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3e6f49b3c0f0d718144dd7ef9eda47e1b0fb4f8cb7a4f30bd5ff390e4e220de
|
|
| MD5 |
9143f4264e8f696e77797442451c85f5
|
|
| BLAKE2b-256 |
1d3479d2f7da3992865bb71731cb0c573530219bb30e07a6e975107eb3e6bdb5
|