Skip to main content

Simple wrapper to send notifications with Telegram Bot

Project description

beves

beves is a simple wrapper to send messages with Telegram Bot. Useful to alert on something or to notify when scripts are finished!

Table of contents

  • Introduction

  • Installing

  • Getting started

  • Usage

  • References

  • License

Introduction

This module provides a simple way to send messages with Telegram Bot. Is useful to notify you when scripts are finished. You can import it into your code or using the command-line utility. In the command-line utility, beves reads the message data as a parameter or from stdin.

Installing

You can install or upgrade beves with:

$ pip install beves --upgrade

Or you can install from source with:

$ git clone https://github.com/andremmorais/beves --recursive
$ cd beves
$ python setup.py install

Getting started

To use Beves you will need the bot token and the chat_id of the sender.

The token can be generated talking with @BotFather on telegram and the chat_id can checked at https://api.telegram.org/bot<YourBOTToken>/getUpdates

Initialize beves config

$ beves
Token: xxxxx
Chat ID: xxxxx

Run from command-line with message data as argv

$ sleep 5 && beves "sleep finished";

Run from command-line with message data from stdin

$ echo "this is a test message" | beves

Run from command-line passing token and chat_id as args

$ beves -t xxxxx -i xxx "this is a test message"

Importing into your code

from beves import Beves
bot = Beves()
bot.push('test')

If you dont have the configuration you will need to pass them as arguments:

from beves import Beves
bot = Beves('token', 'chat_id')
bot.push('test')

Usage

usage: beves [-h] [-t TOKEN] [-i CHAT_ID] [-c CONFIG] [-v] [--version]
             [message [message ...]]

Simple wrapper to send notifications with Telegram Bot

positional arguments:
  message               Message to send

optional arguments:
  -h, --help            show this help message and exit
  -t TOKEN, --token TOKEN
                        telegram bot token
  -i CHAT_ID, --chat_id CHAT_ID
                        sender chat id
  -c CONFIG, --config CONFIG
                        configuration file instead of
                        /Users/andre.morais/.beves
  -v, --verbosity       increase output verbosity
  --version             show program's version number and exit

References

License

You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

beves-0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

beves-0.1-py2.py3-none-any.whl (17.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file beves-0.1.tar.gz.

File metadata

  • Download URL: beves-0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for beves-0.1.tar.gz
Algorithm Hash digest
SHA256 500723483981a9cb6c5fd57786deb2c8e5be910bbd85b183e310d4488f6f36d5
MD5 b740f4b3b0a021aa0928a31542267d0d
BLAKE2b-256 f6cf844c930bf343cbe90e2a585ad29c58004f77a0dbde51545998cc141781ea

See more details on using hashes here.

File details

Details for the file beves-0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: beves-0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for beves-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0006fb0c49b4d6d704c7de68b595c2051cc999a584642ef9e8f509ba41a7539f
MD5 7952108a650040db28bfc1515c9a84e9
BLAKE2b-256 3e189720b84be9ac81d2465b14a5441ecf7f41773cc6e9d78b0d58db94f2f267

See more details on using hashes here.

Supported by

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