kumistatus/siteup.py

18 lines
446 B
Python
Raw Normal View History

2016-09-13 21:27:10 +00:00
#!/usr/bin/python3
import time, setuptools, httptools, twitools
sites = setuptools.getListSetting("HTTP", "sites")
two = twitools.twObject()
def check(site, recipient):
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))
for s in sites:
check(s[0], s[1])