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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42517030cc7d7d6017fa81545fed878efc118222a4125de005201fae9d806a6 |
|
MD5 | 242662133179b72912f1eba84618c1e6 |
|
BLAKE2b-256 | 9e50fb3cbe18fd1a7eba81f63b9b963a9893eb2393b72719e26a8469a54819cd |
File details
Details for the file simple_notifications-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: simple_notifications-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c90a6ee2f2ce5379b78f81ecdae558893a1c87590fb49e8856866c56eee820 |
|
MD5 | 890021948a2c69291a6407a0bbea6188 |
|
BLAKE2b-256 | 3bec1180378c44f349c5e4452a740c1fb59fbc37ccd4eafd6e1f81e3b555f5d4 |