diff options
Diffstat (limited to 'sphinx/util/requests.py')
-rw-r--r-- | sphinx/util/requests.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py index ec3d8d2..4afbd37 100644 --- a/sphinx/util/requests.py +++ b/sphinx/util/requests.py @@ -30,17 +30,19 @@ def _get_tls_cacert(url: str, certs: str | dict[str, str] | None) -> str | bool: def get(url: str, **kwargs: Any) -> requests.Response: - """Sends a GET request like requests.get(). + """Sends a GET request like ``requests.get()``. - This sets up User-Agent header and TLS verification automatically.""" + This sets up User-Agent header and TLS verification automatically. + """ with _Session() as session: return session.get(url, **kwargs) def head(url: str, **kwargs: Any) -> requests.Response: - """Sends a HEAD request like requests.head(). + """Sends a HEAD request like ``requests.head()``. - This sets up User-Agent header and TLS verification automatically.""" + This sets up User-Agent header and TLS verification automatically. + """ with _Session() as session: return session.head(url, **kwargs) @@ -54,7 +56,8 @@ class _Session(requests.Session): ) -> requests.Response: """Sends a request with an HTTP verb and url. - This sets up User-Agent header and TLS verification automatically.""" + This sets up User-Agent header and TLS verification automatically. + """ headers = kwargs.setdefault('headers', {}) headers.setdefault('User-Agent', _user_agent or _USER_AGENT) if _tls_info: |