Skip to main content

Help you get stdout of function execution through Email, Telegram and Line Notify.

Project description

The package busm means bring up Samuel. It's allusion comes from Holy Bible 1 Samuel 28:11. It help you find abnormal situations in a background process.

There are several function decorators and logging handlers inside. These tools can send message of abnormal situations through Email, Telegram or Line Notify.

套件 busm 是 "召喚撒母耳" 的意思,典故出自聖經撒母耳記上 28 章第 11 節,其實就是觀落陰的意思。 這套件可以幫你找出背景作業的異常狀況。

裡面有一些 function decorators 和 logging handlers, 用這些工具可以把異常狀況透過 Email, Telegram, Line Notify 這些方式送出去。

Quick Start

First, install the package.

pip install busm

Then add decorators before functions you'd like to monitor.

import busm

@busm.through_smtp
def foo_email():
    print('It sucks!')

@busm.through_telegram
def foo_telegram():
    print('Segmentation fault.')

@busm.through_line
def foo_line():
    print('Stack overflow.')

if __name__ == '__main__':
    foo_email()
    foo_telegram()
    foo_line()

Run your python code.

python foo.py

You must see the following message, and a config file will be generated in HOME directory.

-----------------------------------------------------------------
  Please change fundog config file (~/.busm.json) to enable.
-----------------------------------------------------------------

Edit this config file ~/.busm.json to fit for you.

{
  "smtp": {
    "host": "smtp.gmail.com",
    "port": 587,
    "user": "someone",
    "pass": "********",
    "from_name": "Foo",
    "from_email": "someone@gmail.com",
    "to_name": "Master",
    "to_email": "someone@gmail.com"
  },
  "telegram": {
    "token": "123456789:-----------------------------------",
    "master": "123456789"
  },
  "line-notify": {
    "token": ""
  }
}

Run your python code again.

python foo.py

Tada! You can preview screenshots here.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

busm-0.9.5-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file busm-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: busm-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for busm-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d7cebc03bf693c35df83f4ddee27b3062be3f16efc531d171341c82bbbe39bd8
MD5 5100fed5299ccdc82f7d73b09605310c
BLAKE2b-256 95e93ca168a1050af72b3f0c04621dcba60c8cebf5896d1e502e2f47b3f3c01f

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