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
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file simple_notifications-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: simple_notifications-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.9 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 | 381d98e4b34bc19fb1d9dc389133eb2c13294056bd4c846bc4bd6f96b3906c48 |
|
MD5 | 5913a4b62faa418d7977d196784b3572 |
|
BLAKE2b-256 | dcbd56e02f7c73ce878f47864f907768490e7e734ee18568572595218da3db38 |