kumistatus/httptools/__init__.py

10 lines
209 B
Python
Raw Normal View History

2016-09-13 21:27:10 +00:00
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