kumistatus/httptools/twitter.py
2017-09-04 09:38:54 +02:00

19 lines
468 B
Python
Executable file

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