Commit 016e007e authored by kaiyou's avatar kaiyou

Add the very first http check and message notifier

parent 3ffc882e
import requests
def simple(url, expected_code=None, expected_string=None):
req = requests.get(url)
if expected_code and req.status_code != expected_code:
raise RuntimeError("HTTP code should be {}".format(expected_code))
if expected_string and string not in req.text:
raise RuntimeError("Result did not contain expected string")
from matrix_client import client as matrix_client
from amonit import util
def mail(name, state, title, body):
print(name, state, title, body)
def matrix_room(name, state, hs, token, roomid, message):
matrix = matrix_client.MatrixHttpApi(hs, token=token)
message = util.render(message, state)
matrix.send_message(roomid, message)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment