Skip to main content

A package for remote program alerts,prints and notification through Telegram

Project description

Project Description

GPLv3 License

pyteleprint

pyteleprint is a package for remote prints, notification and alerts for python programs. The notification mechanism is done via Telegram.

Why should I use this?

This is meant for users who want print() to be a remote notification and alert mechanism if they are not present at their workstation when the program is being executed or for a persisting python application.

Features

  • Remote alerts
  • Remote print
  • Remote notification

Requirements

Requires Python -v >= 3.4.0 Telegram App

Installation

$ pip install pyteleprint

Initial Preparations

The Telegram app must be installed into your mobile system.

First, create a personal bot using (@BotFather). Once the creation process is done, you will receive an API token. Note this API Token for further use.

Using pyteleprint

Create a new script or use shell to execute the following code

from pyteleprint.printer.chat_extract import ChatIDExtractor

API_TOKEN = "YOUR_NEW_BOT_API_TOKEN" # Obtained from creating a bot through BotFather
ChatIDExtractor(API_TOKEN).start()

Once the script is executed, the program would start polling for messages to get chat id. Send a message to your new bot. This will help the program extract the chat id. Use this chat id to send notifications and alerts.

If in future, you delete or lose the chat thread, you can redo the above process to get the new chat id.

Now, you have the API Token and the chat id with you, use them to create a Printer object in your scripts and use the print() method to send notifications,prints and alerts.

from pyteleprint.printer.printer import Printer

API_TOKEN = "YOUR_BOT_API_TOKEN"
CHAT_ID = 12345 # Chat id obtained from ChatIDExtractor().start()
p = Printer(API_TOKEN,CHAT_ID)

p.print("Hello World")

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

pyteleprint-1.0.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

pyteleprint-1.0.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file pyteleprint-1.0.1.tar.gz.

File metadata

  • Download URL: pyteleprint-1.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.21.0 setuptools/43.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.4.0

File hashes

Hashes for pyteleprint-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a04d430c184b54ee0f67ca4a924d219e5605fc81746bf76ba9429811c36dc0e4
MD5 257640f759547945c8c1368112c30033
BLAKE2b-256 088eeb64f6b24bc18b4871db0f9fef6cc198b72fcbbd112414ad8d9889238fe5

See more details on using hashes here.

File details

Details for the file pyteleprint-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyteleprint-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.21.0 setuptools/43.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.4.0

File hashes

Hashes for pyteleprint-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea56dfb1ca9370fcee3ece6c3a21ba6e9fdbc2e18a40b4e34dfb302c52799b7f
MD5 d42abd17b0217a87a70dec4002e5f69d
BLAKE2b-256 0d298831afe8a6c98cd8b9dbdf9ff89a213d9a514f0009714fdb5143c8695c06

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