Commit b72a1e19 authored by Svetlana Tkachenko's avatar Svetlana Tkachenko
Browse files

fixes issue #17, units in s, minor cleanup (thanks msemper)

parent 6b205139
......@@ -44,14 +44,15 @@ class IsItUp(object):
url = args[0][8:]
url = args[0]
if url.endswith("/"): #check if URL has a trailing slash
url = url[:-1] #and remove it if needed
url = "" +url + ".json"
req = Request(url,headers={'User-Agent': 'guppy/'+self.server.config["version"]})
code = "".join(urlopen(req).read().decode('utf8'))
# print(code)
arr = json.loads(code)
arr['up'] = 'up' if arr['status_code'] == 1 else 'not up'
if arr['up'] == 'up':
self.server.doMessage(channel, user + ': %(domain)s:%(port)s is %(up)s. Got HTTP status code %(response_'
'code)03d from %(response_ip)s in %(response_time)f ms.' % arr)
'code)03d from %(response_ip)s in %(response_time)f s.' % arr)
self.server.doMessage(channel, user + ': %s is not up.' % arr['domain'])
Supports Markdown
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