Commit 4a6dc441 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Implement URL checker

parent a2b6d3d2
import urllib.request, urllib.error
def getStatus(url):
return urllib.request.urlopen(url).getcode()
except urllib.error.HTTPError as e:
return e.code
except urllib.error.URLError:
return False
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))
two.tweet("@%s Site %s returns status code %s!" % (recipient, site, status))
for s in sites:
check(s[0], s[1])
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