Skip to main content

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

  1. Create a Telegram bot using @BotFather
  2. Get your bot token from BotFather
  3. Get your user ID by messaging @userinfobot
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telenotif-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telenotif-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for telenotif-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db16ee82cda233d9291695e39baaaf4f4c55ac701a8a5fe040b4f2814247443d
MD5 14260f9a6dd1de0c1bf9c5692219ee5d
BLAKE2b-256 9891a0c95543910638af234619569574a0c071f370f25ba073c5e00343662ec2

See more details on using hashes here.

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

Hashes for telenotif-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e6f49b3c0f0d718144dd7ef9eda47e1b0fb4f8cb7a4f30bd5ff390e4e220de
MD5 9143f4264e8f696e77797442451c85f5
BLAKE2b-256 1d3479d2f7da3992865bb71731cb0c573530219bb30e07a6e975107eb3e6bdb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page