2016-09-13 21:27:10 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import time, setuptools, httptools, twitools
|
|
|
|
|
2017-06-23 19:52:50 +00:00
|
|
|
arg = "w"
|
|
|
|
|
2017-03-19 20:11:16 +00:00
|
|
|
def check(site, recipient, two = twitools.twObject()):
|
2016-09-13 21:27:10 +00:00
|
|
|
status = httptools.getStatus(site)
|
|
|
|
if not status == 200:
|
2017-09-04 07:38:54 +00:00
|
|
|
if not status:
|
2016-09-13 21:27:10 +00:00
|
|
|
two.tweet("@%s Site %s looks down from here!" % (recipient, site))
|
|
|
|
else:
|
|
|
|
two.tweet("@%s Site %s returns status code %s!" % (recipient, site, status))
|
|
|
|
|
2017-06-23 19:52:50 +00:00
|
|
|
def run():
|
2017-03-19 20:11:16 +00:00
|
|
|
sites = setuptools.getListSetting("HTTP", "sites")
|
|
|
|
|
|
|
|
for s in sites:
|
|
|
|
check(s[0], s[1])
|