Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

stop SSL verification (which started by default for python v2.7.9+) #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion health_check
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,19 @@ import re
import socket
import time
import urllib2
import ssl


def check_server_status(url, headers, timeout, expected_status,
expected_regexp):

context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

request = urllib2.Request(url, headers=headers)
try:
fp = urllib2.urlopen(request, timeout=timeout)
fp = urllib2.urlopen(request, timeout=timeout, context=context)
except (urllib2.URLError, httplib.HTTPException, socket.error), e:
return False, str(e)

Expand Down