# simple-notifications
## Installation
* Install from pypi: ```pip install simple-notifications```
## How to use
See [the documentation](https://s7one.gitlab.io/simple-notifications) 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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "simple-notifications",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Email, Notifications",
"author": "Christoph Stein",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# simple-notifications\n\n## Installation\n\n * Install from pypi: ```pip install simple-notifications```\n\n## How to use\n\nSee [the documentation](https://s7one.gitlab.io/simple-notifications) for more information\n\n### Send email with file attachments\n\nmain.py\n```\nfrom simplenotifications import mail\n\nif __name__ == '__main__':\n try:\n mailer = mail.mail(\"myserver\", \"myuser\", \"mypassword\", 25, \"sender@example.com\")\n\n mailer.send('receiver@example.com',\n 'My message',\n 'My subject',\n ['c:\\\\test.txt',\n 'c:\\\\test.png'])\n\n except mail.mail_error as e:\n print(e)\n```\n\n### Send email from template file\n\nmain.py\n```\nfrom simplenotifications import mail\n\nif __name__ == '__main__':\n try:\n mailer = mail.mail(\"myserver\", \"myuser\", \"mypassword\", 25, \"sender@example.com\")\n mailer.send_template(\"receiver@example.com\",\n \"./template.txt'\"\n { \"name\": \"John\"},\n 'Testsubject')\n except mail.mail_error as e:\n print(e)\n```\n\ntemplate.txt\n```\nHello, $name!\n```\n\n### Send webhook message (http post request)\n\nmain.py\n```\nfrom simplenotifications import webhook\n\nif __name__ == '__main__':\n hook = webhook.webhook_post(\"http://example.com/webhook\")\n try:\n hook.post(\"Hello, world!\")\n except webhook.webhook_error as e:\n print(e)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Send notfications by email or webhook",
"version": "0.1.3",
"project_urls": {
"documentation": "https://s7one.gitlab.io/simple-notifications",
"homepage": "https://gitlab.com/s7one/simple-notifications",
"repository": "https://gitlab.com/s7one/simple-notifications"
},
"split_keywords": [
"email",
" notifications"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dcbd56e02f7c73ce878f47864f907768490e7e734ee18568572595218da3db38",
"md5": "5913a4b62faa418d7977d196784b3572",
"sha256": "381d98e4b34bc19fb1d9dc389133eb2c13294056bd4c846bc4bd6f96b3906c48"
},
"downloads": -1,
"filename": "simple_notifications-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5913a4b62faa418d7977d196784b3572",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6948,
"upload_time": "2024-04-04T11:35:41",
"upload_time_iso_8601": "2024-04-04T11:35:41.449819Z",
"url": "https://files.pythonhosted.org/packages/dc/bd/56e02f7c73ce878f47864f907768490e7e734ee18568572595218da3db38/simple_notifications-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-04 11:35:41",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "s7one",
"gitlab_project": "simple-notifications",
"lcname": "simple-notifications"
}