Disable Ssl Certificate Validation In Mechanize
I am new to python and I was trying to access a website using mechanize. br = mechanize.Browser() r=br.open('https://172.22.2.2/') Which gives me the following error: Traceback (m
Solution 1:
Add this code snippet to disable HTTPS certificate validation before br.open().
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by defaultpasselse:
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = _create_unverified_https_context
For people asking for explanation: check this link.
Post a Comment for "Disable Ssl Certificate Validation In Mechanize"