12 lines
388 B
Python
12 lines
388 B
Python
import urllib.request, urllib.error
|
|
|
|
def getStatus(url):
|
|
if not "://" in url:
|
|
url = "http://" + url
|
|
req = urllib.request.Request(url, data=None, headers={'User-Agent': 'KumiStatus/0.8.15 (+https://kumig.it/kumitterer/kumistatus)'})
|
|
try:
|
|
return urllib.request.urlopen(req).getcode()
|
|
except urllib.error.HTTPError as e:
|
|
return e.code
|
|
except urllib.error.URLError:
|
|
return False
|