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.2.tar.gz (4.6 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.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file telenotif-0.1.2.tar.gz.

File metadata

  • Download URL: telenotif-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 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.2.tar.gz
Algorithm Hash digest
SHA256 e63acac04287429ff13f488c1483e853473c521b8fc7a266728523e6e9f8fb5a
MD5 bbf82e3df3133d5ca326ed4e030d9c99
BLAKE2b-256 d0f2ad9d8ced7d6bfa90d41074cfab36e4cec429448c1336de43208ac9d8c5af

See more details on using hashes here.

File details

Details for the file telenotif-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: telenotif-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71dffc3efdb8043ac9195e445f8f0fbd37c543e539e89b818153b4ed5f42ed8d
MD5 ac384fedee39859611e432c644bfb5df
BLAKE2b-256 8c0fcd3de730ef42a18ed6feef04a0ab278e260ff9dea5a1b7575cd2b64ab13d

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