summaryrefslogtreecommitdiff
path: root/sphinx/util/requests.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/requests.py')
-rw-r--r--sphinx/util/requests.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py
index c19e05cec..3a3c2b6cb 100644
--- a/sphinx/util/requests.py
+++ b/sphinx/util/requests.py
@@ -47,7 +47,7 @@ except ImportError:
# try to load requests[security] (but only if SSL is available)
try:
- import ssl
+ import ssl # NOQA
except ImportError:
pass
else:
@@ -55,17 +55,7 @@ else:
pkg_resources.require(['requests[security]'])
except (pkg_resources.DistributionNotFound,
pkg_resources.VersionConflict):
- if not getattr(ssl, 'HAS_SNI', False):
- # don't complain on each url processed about the SSL issue
- 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 '
- 'against the hostname in the url requested. Recommended to '
- 'install "requests[security]" as a dependency or upgrade to '
- 'a python version with SNI support (Python 3 and Python 2.7.9+).'
- )
+ pass # ignored
except pkg_resources.UnknownExtra:
warnings.warn(
'Some links may return broken results due to being unable to '
@@ -78,7 +68,6 @@ if False:
# For type annotation
from typing import Any, Generator, Union # NOQA
from sphinx.config import Config # NOQA
- from sphinx.util.typing import unicode # NOQA
useragent_header = [('User-Agent',
'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0')]
@@ -108,7 +97,7 @@ def ignore_insecure_warning(**kwargs):
def _get_tls_cacert(url, config):
- # type: (unicode, Config) -> Union[str, bool]
+ # type: (str, Config) -> Union[str, bool]
"""Get additional CA cert for a specific URL.
This also returns ``False`` if verification is disabled.
@@ -131,7 +120,7 @@ def _get_tls_cacert(url, config):
def get(url, **kwargs):
- # type: (unicode, Any) -> requests.Response
+ # type: (str, Any) -> requests.Response
"""Sends a GET request like requests.get().
This sets up User-Agent header and TLS verification automatically."""
@@ -145,7 +134,7 @@ def get(url, **kwargs):
def head(url, **kwargs):
- # type: (unicode, Any) -> requests.Response
+ # type: (str, Any) -> requests.Response
"""Sends a HEAD request like requests.head().
This sets up User-Agent header and TLS verification automatically."""