I need to simulate somehow option -k
(vide --insecure
to ignore SSL certificate verification) for curl
but using urllib2
. Any clues?
Asked
Active
Viewed 1.4k times
1 Answers
3
There is nothing special to do here. urllib2
does not do SSL certificate verification by default. There is a warning in the documentation http://docs.python.org/library/urllib2.html
Warning HTTPS requests do not do any verification of the server’s certificate.

Bruno
- 119,590
- 31
- 270
- 376

Mark Lavin
- 24,664
- 5
- 76
- 70
-
What's a good urllib2 alternative that does SSL certificate verification? – kiminoa Mar 11 '14 at 19:37
-
Actually, it looks like httplib (or http.client in Python 3.0) provides an HTTPSConnection which skips verification. – kiminoa Mar 11 '14 at 19:47
-
http://docs.python-requests.org/en/latest/ is a popular library which does SSL verification by default. – Mark Lavin Mar 11 '14 at 20:12
-
1Apperantly newer versions do:http://stackoverflow.com/questions/19268548/python-ignore-certicate-validation-urllib2 – Bernhard Jun 03 '16 at 13:26
-
2Yes this changed in Python 2.7.9. – Mark Lavin Jun 03 '16 at 14:15