wrapper function for apprise

This commit is contained in:
jblu 2023-05-12 10:36:28 -05:00
parent 043f0cfcd1
commit 9a50fc7cf4
3 changed files with 23 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.toml
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

15
Apprise-Client.py Normal file
View File

@ -0,0 +1,15 @@
import requests as r
from tomllib import load
config_file_path = './config.toml'
with open(config_file_path, 'rb') as c:
config = load(c)
def apprise_notify(req_obj, host, port, aurls, title, body):
payload = {'urls': aurls,'title': title,'body': body,}
url = f'http://{host}:{port}/notify/'
apprise_response = req_obj.post(url, json = payload ,verify=False)
return apprise_response
a = apprise_notify(r,config["apprise"]["host"],config["apprise"]["port"],config["apprise"]["aurls"],\
config["apprise"]["title"],config["apprise"]["body"])

6
config.toml.example Normal file
View File

@ -0,0 +1,6 @@
[apprise]
host = "192.168.x.x"
port = 8088
aurls = 'mailto://user:pass@gmail.com'
title = 'test title'
body = 'test body'