healthchecks_healthchecks/templates/front/snippets/python_urllib2.txt
2020-07-17 17:21:10 +03:00

9 lines
217 B
Plaintext

# Using Python 3 standard library:
import socket
import urllib.request
try:
urllib.request.urlopen("PING_URL", timeout=10)
except socket.error as e:
# Log ping failure here...
print("Ping failed: %s" % e)