Public bug reported: The following code to retrieve a valid HTTPS URL fails under both Python 2.7 and Python2.6 (install from a PPA):
import urllib2 urllib2.urlopen('https://www1.pplweb.com').read() Traceback (most recent call last): File "test.py", line 2, in <module> urllib2.urlopen('https://www1.pplweb.com').read() File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1215, in https_open return self.do_open(httplib.HTTPSConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open raise URLError(err) urllib2.URLError: <urlopen error [Errno 1] _ssl.c:504: error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000)> The same basic code also fails with Python 3.2: from urllib.request import urlopen urlopen('https://www1.pplweb.com').read() Traceback (most recent call last): File "/usr/lib/python3.2/urllib/request.py", line 1135, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/lib/python3.2/http/client.py", line 967, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.2/http/client.py", line 1005, in _send_request self.endheaders(body) File "/usr/lib/python3.2/http/client.py", line 963, in endheaders self._send_output(message_body) File "/usr/lib/python3.2/http/client.py", line 808, in _send_output self.send(msg) File "/usr/lib/python3.2/http/client.py", line 746, in send self.connect() File "/usr/lib/python3.2/http/client.py", line 1108, in connect server_hostname=server_hostname) File "/usr/lib/python3.2/ssl.py", line 189, in wrap_socket _context=self) File "/usr/lib/python3.2/ssl.py", line 276, in __init__ raise x File "/usr/lib/python3.2/ssl.py", line 272, in __init__ self.do_handshake() File "/usr/lib/python3.2/ssl.py", line 451, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [Errno 1] _ssl.c:392: error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test2.py", line 2, in <module> urlopen('https://www1.pplweb.com').read() File "/usr/lib/python3.2/urllib/request.py", line 138, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.2/urllib/request.py", line 369, in open response = self._open(req, data) File "/usr/lib/python3.2/urllib/request.py", line 387, in _open '_open', req) File "/usr/lib/python3.2/urllib/request.py", line 347, in _call_chain result = func(*args) File "/usr/lib/python3.2/urllib/request.py", line 1171, in https_open context=self._context, check_hostname=self._check_hostname) File "/usr/lib/python3.2/urllib/request.py", line 1138, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 1] _ssl.c:392: error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1000)> This should return the html for the 403 error page, not an internal SSL parsing error. I'm running Ubuntu 12.04. Strangely, this code runs fine under Python2.6 on Fedora 13, but returns a "httplib.BadStatusLine: ''" error under Python2.7 on Fedora 16. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: python 2.7.3-0ubuntu2 ProcVersionSignature: Ubuntu 3.2.0-24.39-generic 3.2.16 Uname: Linux 3.2.0-24-generic x86_64 NonfreeKernelModules: nvidia wl ApportVersion: 2.0.1-0ubuntu8 Architecture: amd64 Date: Tue Jun 26 10:41:49 2012 InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64+mac (20111012) SourcePackage: python-defaults UpgradeStatus: Upgraded to precise on 2012-05-10 (46 days ago) ** Affects: python-defaults (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug precise -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1017976 Title: Python Urllib2 Unable to Open HTTPS URL To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/1017976/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs