Search code examples
pythonpython-2.7urllib2python-requests

python ignore certificate validation urllib2


I want to ignore the certification validation during my request to the server with an internal corporate link.

With python requests library I would do this:

r = requests.get(link, allow_redirects=False,verify=False)

How do I do the same with urllib2 library?


Solution

  • urllib2 does not verify server certificate by default. Check this documentation.

    Edit: As pointed out in below comment, this is not true anymore for newer versions (seems like >= 2.7.9) of Python. Refer the below ANSWER