Skip to main content

No project description provided

Project description

JupNotiPy

Simple class for Python Telegram bot notifications, ideal for Jupyter notebooks and long-running scripts.

Features

  1. Easy setup: Quickly initialize your Telegram bot and get your chat_id.
  2. Customizable notifications: Send messages with custom text.
  3. Credential management: Cache and manage your bot credentials seamlessly.

How this works

JupNotiPy uses your Telegram bot to send you messages. The process involves two main steps:

  1. Initialization: Required for obtaining a chat_id.
  2. Sending: Used for sending notifications through the given bot.

Installation

Install JupNotiPy using pip:

pip install jupnotipy

CLI Usage

Step 1: Initialize and Obtain chat_id

To initialize JupNotiPy and obtain your chat_id, use the following command:

jupnotipy init --bot_token "YOUR_BOT_TOKEN"

This will create a credentials file for future use.

Step 2: Send a Message

To send a message using the CLI:

jupnotipy send

Or, to send a custom message:

jupnotipy send --text "MY FANCY MESSAGE"

Python API

Step 1: Login and Initialize

To log in and initialize JupNotiPy within your Python script:

import jupnotipy

jupnotipy.login(bot_token="YOUR_BOT_TOKEN")

Step 2: Send Notifications

Use cached credentials to send a notification:

jupnotipy.notify()

Override cached credentials and send a notification:

jupnotipy.notify(bot_token="YOUR_BOT_TOKEN", chat_id=0)

Send a custom message:

jupnotipy.notify(message="MY_FANCY_MESSAGE")

Update cached credentials:

jupnotipy.notify(bot_token="YOUR_BOT_TOKEN", chat_id=0, update_credentials=True)

Example Code

Here's a sample Python script using JupNotiPy:

import jupnotipy

jupnotipy.login(bot_token="YOUR_BOT_TOKEN")

# use cached credentials
jupnotipy.notify()

# override the cached credentials
jupnotipy.notify(bot_token="YOUR_BOT_TOKEN", chat_id=0)

# define custom message
jupnotipy.notify(message="MY_FANCY_MESSAGE")

# update cached credentials
jupnotipy.notify(bot_token="YOUR_BOT_TOKEN", chat_id=0, update_credentials=True)

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

jupnotipy-0.1.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

jupnotipy-0.1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file jupnotipy-0.1.4.tar.gz.

File metadata

  • Download URL: jupnotipy-0.1.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.0 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for jupnotipy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 60572c3bef7188e041aa296f9f7952d2b4ccd58eff832fd634ccdef966c3bc50
MD5 c3efc7920d64f01478ab1c2ddef2739e
BLAKE2b-256 12e332c091d6ee581239cbe9661976485e623f3ec9449478fa2b79e4ddc9bbca

See more details on using hashes here.

File details

Details for the file jupnotipy-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: jupnotipy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.0 CPython/3.12.3 Darwin/23.5.0

File hashes

Hashes for jupnotipy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 29e780d87747afc0f5ef2a8f4113a8e9375fb8b9664d2b59c10cf09b9b18d7f1
MD5 0479ffc78ebf13a7fb21a9260d633a0b
BLAKE2b-256 5c85606d8f1c089b5940789ff62826ab632f72673b78f99c8470b1aa7d1dee64

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