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

See the documentation for more information

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 Distributions

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

Built Distribution

simple_notifications-0.1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for simple_notifications-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 381d98e4b34bc19fb1d9dc389133eb2c13294056bd4c846bc4bd6f96b3906c48
MD5 5913a4b62faa418d7977d196784b3572
BLAKE2b-256 dcbd56e02f7c73ce878f47864f907768490e7e734ee18568572595218da3db38

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