kumistatus/siteup.py
Klaus-Uwe Mitterer 8fcfe72f5b Some refactoring
2017-03-19 21:11:16 +01:00

18 lines
477 B
Python
Executable file

#!/usr/bin/python3
import time, setuptools, httptools, twitools
def check(site, recipient, two = twitools.twObject()):
status = httptools.getStatus(site)
if not status == 200:
if status == None:
two.tweet("@%s Site %s looks down from here!" % (recipient, site))
else:
two.tweet("@%s Site %s returns status code %s!" % (recipient, site, status))
if __name__ == "__main__":
sites = setuptools.getListSetting("HTTP", "sites")
for s in sites:
check(s[0], s[1])