tools/web: factorize getNormalizedURL

This commit is contained in:
nemunaire 2015-10-14 00:17:02 +02:00
commit 55e6550cb1
7 changed files with 26 additions and 21 deletions

View file

@ -1,6 +1,6 @@
import urllib
from nemubot.tools.web import getJSON
from nemubot.tools.web import getNormalizedURL, getJSON
def isup(url):
"""Determine if the given URL is up or not
@ -9,7 +9,7 @@ def isup(url):
url -- the URL to check
"""
o = urllib.parse.urlparse(url, "http")
o = urllib.parse.urlparse(getNormalizedURL(url), "http")
if o.netloc != "":
isup = getJSON("http://isitup.org/%s.json" % o.netloc)
if isup is not None and "status_code" in isup and isup["status_code"] == 1: