Skip to main content

Send notfications by email or webhook

Project description

simple-notifications

Installation

  • Install from pypi: pip install simple-notifications

How to use

Send email with file attachments

main.py

from simplenotifications import mail

if __name__ == '__main__':
    try:
        mailer = mail.mail("myserver", "myuser", "mypassword", 25, "sender@example.com")

        mailer.send('receiver@example.com',
                    'My message',
                    'My subject',
                    ['c:\\test.txt',
                     'c:\\test.png'])

    except mail.mail_error as e:
        print(e)

Send email from template file

main.py

from simplenotifications import mail

if __name__ == '__main__':
    try:
        mailer = mail.mail("myserver", "myuser", "mypassword", 25, "sender@example.com")
        mailer.send_template("receiver@example.com",
                             "./template.txt'"
                             { "name": "John"},
                             'Testsubject')
    except mail.mail_error as e:
        print(e)

template.txt

Hello, $name!

Send webhook message (http post request)

main.py

from simplenotifications import webhook

if __name__ == '__main__':
    hook = webhook.webhook_post("http://example.com/webhook")
    try:
        hook.post("Hello, world!")
    except webhook.webhook_error as e:
        print(e)

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

simple-notifications-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

simple_notifications-0.1.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file simple-notifications-0.1.2.tar.gz.

File metadata

  • Download URL: simple-notifications-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for simple-notifications-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d42517030cc7d7d6017fa81545fed878efc118222a4125de005201fae9d806a6
MD5 242662133179b72912f1eba84618c1e6
BLAKE2b-256 9e50fb3cbe18fd1a7eba81f63b9b963a9893eb2393b72719e26a8469a54819cd

See more details on using hashes here.

File details

Details for the file simple_notifications-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_notifications-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0c90a6ee2f2ce5379b78f81ecdae558893a1c87590fb49e8856866c56eee820
MD5 890021948a2c69291a6407a0bbea6188
BLAKE2b-256 3bec1180378c44f349c5e4452a740c1fb59fbc37ccd4eafd6e1f81e3b555f5d4

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