Skip to main content

Easy bug reporter for small projects. Zero dependencies - download and run. Asyncio support.

Project description

Easy Notifyer

image image image image

Easy bug reporter for small projects. Zero dependencies - download and run. Asyncio support.

Documentation


Install

pip install easy-notifyer


Example usage:

Telegram reporter

from easy_notifyer import telegram_reporter

exception_telegram_reporter = telegram_reporter(
    token="123456789:QweRtyuWErtyZxcdsG",
    chat_id=123456789,  # can be list from chat_id: [123456789, 876522345], or @username
    service_name='qwe'
)

@exception_telegram_reporter(exceptions=OSError)
def foo():
    ...
    raise OSError
from easy_notifyer import telegram_reporter


exception_telegram_reporter = telegram_reporter(
    token="123456789:QweRtyuWErtyZxcdsG",
    chat_id="@my_super_nickname",
    api_url='https://your_super_url_api.com/'
)

@exception_telegram_reporter(
    exceptions=OSError,               # can be tuple from exceptions
    as_attached=True,                 # to send traceback as a file
    filename='bar_report.log',        # custom filename for attach
    header='Testing for bar',         # first line in message-report. default: "Your program has crashed ☠️"
    datetime_format="%d - %H:%M:%S",  # format datetime for report
)
async def bar():
    ...
    raise OSError

Can be using params disable_web_page_preview and disable_notification:

from easy_notifyer import telegram_reporter


exception_telegram_reporter = telegram_reporter(
    token="123456789:QweRtyuWErtyZxcdsG",
    chat_id=["@superadmin1", "@superadmin2"],
)

@exception_telegram_reporter(
    header='Test request to http://example.com',
    disable_web_page_preview=True,  # not worked if as_attach=True
    disable_notification=True,
)
def foo():
    ...
    raise ValueError

Can be using basic client:

from easy_notifyer import Telegram


def main():
    ...
    telegram = Telegram()
    telegram.send_message('hello from easy notifyer')
    img = open('my_image.jpg', 'rb')
    telegram.send_attach(img, filename='my_image.jpg')


async def main_async():
    ...
    telegram = Telegram()
    await telegram.async_send_message('async hello from easy notifyer')
    img = open('my_image.jpg', 'rb')
    await telegram.async_send_attach(img, filename='my_image.jpg')

Mail reporter

from easy_notifyer import mailer_reporter


exception_telegram_reporter = mailer_reporter(
    host='smtp.example.org',
    port=587,
    login='login@example.com',
    password='qwerty12345',
    from_addr='login@example.com',
    to_addrs='myemail@gmail.com, mysecondmail@mail.com',
    ssl=False,
    service_name='super app'
)

@exception_telegram_reporter(exceptions=ValueError)
def bar():
    ...
    raise ValueError
from easy_notifyer import mailer_reporter

exception_telegram_reporter = mailer_reporter(
    host='smtp.example.org',
    port=587,
    login='login@example.com',
    password='qwerty12345',
    from_addr='login@example.com',
    to_addrs='myemail@gmail.com, mysecondmail@mail.com',
    ssl=False,
)

@exception_telegram_reporter(
    exceptions=OSError,               # can be tuple from exceptions
    as_attached=True,                 # to send traceback as a file
    filename='bar_report.log',        # custom filename for attach
    header='Testing for bar',         # first line in message-report. default: "Your program has crashed ☠️"
    subject='hello from foobar',      # set custom subject for message
    datetime_format="%d - %H:%M:%S",  # format datetime for report
)
async def foobar():
    ...
    raise OSError

Can be using basic client:

from easy_notifyer import Mailer


def main():
    ...
    mailer = Mailer()
    img = open('my_image.jpg', 'rb')
    mailer.send_message(
        message='hello from main',
        subject='custom subject for message',
        attach=img,
        filename='my_image.jpg',
    )

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

easy_notifyer-0.2.0.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.

easy_notifyer-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file easy_notifyer-0.2.0.tar.gz.

File metadata

  • Download URL: easy_notifyer-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for easy_notifyer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b34e879ff485a9eedb841abe053ea48b2f281c9021abce44a952ec169d589887
MD5 e8f840f84516334b477ec09d5cc57a65
BLAKE2b-256 f860d0ce0f8efd15789734ae4b945618a46eb806c4d765eb56dffc740adee6ee

See more details on using hashes here.

File details

Details for the file easy_notifyer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: easy_notifyer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for easy_notifyer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c602da2e3ff81bd63deb24db15378013665e537978b67c64ebc4555c261aaa5
MD5 1e16d9a58a3d7ddb175cf955a9064ea7
BLAKE2b-256 5f0aa7095f5f9dfe3edb02602d8fd060e2714e8db0ae600931338ccfe3bea98e

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