ssl.CertificateError not always available
This commit is contained in:
parent
69bae532c5
commit
e4218c7612
|
@ -205,8 +205,13 @@ else:
|
||||||
# Exception "constants" to support Python 2 through Python 3
|
# Exception "constants" to support Python 2 through Python 3
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
HTTP_ERRORS = (HTTPError, URLError, socket.error, ssl.SSLError,
|
try:
|
||||||
ssl.CertificateError)
|
CERT_ERROR = (ssl.CertificateError,)
|
||||||
|
except AttributeError:
|
||||||
|
CERT_ERROR = tuple()
|
||||||
|
|
||||||
|
HTTP_ERRORS = ((HTTPError, URLError, socket.error, ssl.SSLError) +
|
||||||
|
CERT_ERROR)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HTTP_ERRORS = (HTTPError, URLError, socket.error)
|
HTTP_ERRORS = (HTTPError, URLError, socket.error)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue