kumistatus/httptools/__init__.py
2016-09-13 23:27:10 +02:00

9 lines
209 B
Python

import urllib.request, urllib.error
def getStatus(url):
try:
return urllib.request.urlopen(url).getcode()
except urllib.error.HTTPError as e:
return e.code
except urllib.error.URLError:
return False