Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mkdocs_rss_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ def get_remote_image_length(
image_url: str,
http_method: str = "HEAD",
attempt: int = 0,
req_timeout: tuple[float, float] = (5, 30),
ssl_verify: bool = True,
) -> Optional[int]:
"""Retrieve length for remote images (starting with 'http').
Expand All @@ -668,6 +669,8 @@ def get_remote_image_length(
http_method (str, optional): HTTP method to use for the request.
Defaults to "HEAD".
attempt (int, optional): request tries counter. Defaults to 0.
req_timeout (tuple[float, float], optional): (connect, read) timeout in \
secondes. Defaults to (5, 30).
ssl_verify (bool, optional): option to perform SSL verification or not.
Defaults to True.

Expand All @@ -685,7 +688,10 @@ def get_remote_image_length(
f"Sending {http_method} request to {image_url}"
)
req_response = self.req_session.request(
method=http_method, url=image_url, verify=ssl_verify
method=http_method,
timeout=req_timeout,
url=image_url,
verify=ssl_verify,
)
req_response.raise_for_status()
img_length = req_response.headers.get("content-length")
Expand Down