5
changelogs/fragments/78648-urllib3-import-exceptions.yml
Normal file
5
changelogs/fragments/78648-urllib3-import-exceptions.yml
Normal file
@ -0,0 +1,5 @@
|
||||
bugfixes:
|
||||
- urls - Guard imports of ``urllib3`` by catching ``Exception`` instead of
|
||||
``ImportError`` to prevent exceptions in the import process of optional
|
||||
dependencies from preventing use of ``urls.py``
|
||||
(https://github.com/ansible/ansible/issues/78648)
|
||||
@ -126,19 +126,19 @@ try:
|
||||
HAS_URLLIB3_SSL_WRAP_SOCKET = False
|
||||
try:
|
||||
from urllib3.contrib.pyopenssl import PyOpenSSLContext
|
||||
except ImportError:
|
||||
except Exception:
|
||||
from requests.packages.urllib3.contrib.pyopenssl import PyOpenSSLContext
|
||||
HAS_URLLIB3_PYOPENSSLCONTEXT = True
|
||||
except ImportError:
|
||||
except Exception:
|
||||
# urllib3<1.15,>=1.6
|
||||
HAS_URLLIB3_PYOPENSSLCONTEXT = False
|
||||
try:
|
||||
try:
|
||||
from urllib3.contrib.pyopenssl import ssl_wrap_socket
|
||||
except ImportError:
|
||||
except Exception:
|
||||
from requests.packages.urllib3.contrib.pyopenssl import ssl_wrap_socket
|
||||
HAS_URLLIB3_SSL_WRAP_SOCKET = True
|
||||
except ImportError:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Select a protocol that includes all secure tls protocols
|
||||
|
||||
Reference in New Issue
Block a user