2016-09-13 21:27:10 +00:00
|
|
|
import urllib.request, urllib.error
|
|
|
|
|
|
|
|
def getStatus(url):
|
2017-06-23 19:52:50 +00:00
|
|
|
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)'})
|
2016-09-13 21:27:10 +00:00
|
|
|
try:
|
2017-06-23 19:52:50 +00:00
|
|
|
return urllib.request.urlopen(req).getcode()
|
2016-09-13 21:27:10 +00:00
|
|
|
except urllib.error.HTTPError as e:
|
|
|
|
return e.code
|
|
|
|
except urllib.error.URLError:
|
|
|
|
return False
|