tools/web: factorize getNormalizedURL
This commit is contained in:
parent
76ec0d26b4
commit
55e6550cb1
7 changed files with 26 additions and 21 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue