This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Paul.Wiseman
Recipients Paul.Wiseman
Date 2013-04-08.15:35:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365435360.08.0.632289322267.issue17664@psf.upfronthosting.co.za>
In-reply-to
Content
I was using py2.7.3 and was getting None back for the errno attribute for an ssl.SSLError('The read operation timed out').

I noticed in the 2.7.4 release notes that it sounds like there was a fix for this:

Issue #12065: connect_ex() on an SSL socket now returns the original errno
when the socket's timeout expires (it used to return None).

I've just tested in py2.7.4 and I'm still getting None back for the errno attribute.

I'm using this code to produce the error:

import requests

def __init__(self, exception):
    # First extract the real underlying exception
    exception = exception.args[0]  # This should be ssl.SSLError
    super(requests.exceptions.ConnectionError, self).__init__(exception)
    self.strerror = exception.strerror
    self.errno = exception.errno

requests.exceptions.ConnectionError.__init__ = __init__

timeout_val = 0.2
while True:
    try:
        print requests.get("https://google.com", timeout=timeout_val)
    except requests.exceptions.SSLError as err:
        print err.strerror
        print err.errno
        break
    except Exception as err:
        print "Got %s: %s" % (err.__class__.__name__, err)
    timeout_val /= 2
History
Date User Action Args
2013-04-08 15:36:00Paul.Wisemansetrecipients: + Paul.Wiseman
2013-04-08 15:36:00Paul.Wisemansetmessageid: <1365435360.08.0.632289322267.issue17664@psf.upfronthosting.co.za>
2013-04-08 15:36:00Paul.Wisemanlinkissue17664 messages
2013-04-08 15:35:59Paul.Wisemancreate