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.
Metadata
Release files for telenotif 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| telenotif-0.1.3.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| telenotif-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / telenotif-0.1.3.tar.gz
| Download URL | telenotif-0.1.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b269bd9228e6a640ec8e8943cd840bcf3f38633fcc77739ae8d28bd88f9533b
|
|
BLAKE2b-256 checksum How to use checksums |
299dde07abc865cf7cd47b18ea36d469d9374de8da028249ebafaf747b664483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.4
|
Release files / telenotif-0.1.3-py3-none-any.whl
| Download URL | telenotif-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b40f55a8c8c9cd2c271c550a3f5c8a3b4b29e005e88ff22433c29b20e23c2fd9
|
|
BLAKE2b-256 checksum How to use checksums |
545796e68e7c22df969bdfc5b27902c07aae85313f7c2b547ea403777a7654a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.4
|