mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #3614: Sphinx crashes with requests-2.5.0
This commit is contained in:
parent
a9256bfa70
commit
b6e4cceb8f
2
CHANGES
2
CHANGES
@ -13,6 +13,8 @@ Features added
|
|||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* #3614: Sphinx crashes with requests-2.5.0
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -36,6 +36,16 @@ except ImportError:
|
|||||||
# for requests < 2.4.0
|
# for requests < 2.4.0
|
||||||
InsecureRequestWarning = None
|
InsecureRequestWarning = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from requests.packages.urllib3.exceptions import InsecurePlatformWarning
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
# for Debian-jessie
|
||||||
|
from urllib3.exceptions import InsecurePlatformWarning
|
||||||
|
except ImportError:
|
||||||
|
# for requests < 2.4.0
|
||||||
|
InsecurePlatformWarning = None
|
||||||
|
|
||||||
# try to load requests[security] (but only if SSL is available)
|
# try to load requests[security] (but only if SSL is available)
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
@ -48,8 +58,8 @@ else:
|
|||||||
pkg_resources.VersionConflict):
|
pkg_resources.VersionConflict):
|
||||||
if not getattr(ssl, 'HAS_SNI', False):
|
if not getattr(ssl, 'HAS_SNI', False):
|
||||||
# don't complain on each url processed about the SSL issue
|
# don't complain on each url processed about the SSL issue
|
||||||
requests.packages.urllib3.disable_warnings(
|
if InsecurePlatformWarning:
|
||||||
requests.packages.urllib3.exceptions.InsecurePlatformWarning)
|
requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
'Some links may return broken results due to being unable to '
|
'Some links may return broken results due to being unable to '
|
||||||
'check the Server Name Indication (SNI) in the returned SSL cert '
|
'check the Server Name Indication (SNI) in the returned SSL cert '
|
||||||
|
Loading…
Reference in New Issue
Block a user