2023-05-12 10:36:28 -05:00
|
|
|
import requests as r
|
|
|
|
from tomllib import load
|
2023-05-16 12:38:40 -05:00
|
|
|
import os
|
|
|
|
|
|
|
|
if os.environ["toml_path"]:
|
|
|
|
config_file_path=os.environ["toml_path"]
|
|
|
|
else:
|
|
|
|
config_file_path = './config.toml'
|
2023-05-12 10:36:28 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-05-12 11:48:19 -05:00
|
|
|
if __name__ == "__main__":
|
|
|
|
a = apprise_notify(r,config["apprise"]["host"],config["apprise"]["port"],config["apprise"]["aurls"],\
|
|
|
|
config["apprise"]["title"],config["apprise"]["body"])
|