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.3.tar.gz (5.0 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.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: telenotif-0.1.3.tar.gz
  • Upload date:
  • Size: 5.0 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.3.tar.gz
Algorithm Hash digest
SHA256 1b269bd9228e6a640ec8e8943cd840bcf3f38633fcc77739ae8d28bd88f9533b
MD5 c59a1562086ad69471a12da2efd3d204
BLAKE2b-256 299dde07abc865cf7cd47b18ea36d469d9374de8da028249ebafaf747b664483

See more details on using hashes here.

File details

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

File metadata

  • Download URL: telenotif-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b40f55a8c8c9cd2c271c550a3f5c8a3b4b29e005e88ff22433c29b20e23c2fd9
MD5 595392e7a81b1ea33ea56503522f5d2b
BLAKE2b-256 545796e68e7c22df969bdfc5b27902c07aae85313f7c2b547ea403777a7654a3

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