wrapper function for apprise
This commit is contained in:
parent
043f0cfcd1
commit
9a50fc7cf4
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
*.toml
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
15
Apprise-Client.py
Normal file
15
Apprise-Client.py
Normal 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
6
config.toml.example
Normal 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'
|
Loading…
x
Reference in New Issue
Block a user