diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-04-24 18:40:04 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-04-24 18:40:04 +0300 |
commit | e3d14e7862217774f0efe632c4f8b64df2e7eba7 (patch) | |
tree | 68e0e023bfed049c1ff27d7f2b77a39a5d857bf0 /sphinx/util/requests.py | |
parent | 10afb48b8e6e6db61dec9665ae3bd7035b571853 (diff) | |
parent | 7897678777982e942aa6c22b823aced7ffd07095 (diff) |
Merge branch 'stable' into 1.6-release
Diffstat (limited to 'sphinx/util/requests.py')
-rw-r--r-- | sphinx/util/requests.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py index 3b4b7f8b6..09b7a43b1 100644 --- a/sphinx/util/requests.py +++ b/sphinx/util/requests.py @@ -36,6 +36,16 @@ except ImportError: # for requests < 2.4.0 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: import ssl @@ -48,8 +58,8 @@ else: pkg_resources.VersionConflict): if not getattr(ssl, 'HAS_SNI', False): # don't complain on each url processed about the SSL issue - requests.packages.urllib3.disable_warnings( - requests.packages.urllib3.exceptions.InsecurePlatformWarning) + if InsecurePlatformWarning: + requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) warnings.warn( 'Some links may return broken results due to being unable to ' 'check the Server Name Indication (SNI) in the returned SSL cert ' |