File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 30
30
from mkdocs .structure .pages import Page
31
31
from mkdocs .utils import get_build_datetime
32
32
from requests import Session
33
- from requests .exceptions import HTTPError
33
+ from requests .exceptions import ConnectionError , HTTPError
34
34
35
35
# package
36
36
from mkdocs_rss_plugin .constants import MKDOCS_LOGGER_NAME , REMOTE_REQUEST_HEADERS
@@ -643,16 +643,20 @@ def get_remote_image_length(
643
643
# first, try HEAD request to avoid downloading the image
644
644
try :
645
645
attempt += 1
646
+ logger .debug (
647
+ f"Get remote image length (attempt { attempt } /2) - "
648
+ f"Sending { http_method } request to { image_url } "
649
+ )
646
650
req_response = self .req_session .request (
647
651
method = http_method , url = image_url , verify = ssl_verify
648
652
)
649
653
req_response .raise_for_status ()
650
654
img_length = req_response .headers .get ("content-length" )
651
- except HTTPError as err :
655
+ except ( ConnectionError , HTTPError ) as err :
652
656
logger .debug (
653
657
f"Remote image could not been reached: { image_url } . "
654
- f"Trying again with GET and disabling SSL verification. Attempt: { attempt } . "
655
- f"Trace: { err } "
658
+ f"Trying again with { http_method } and disabling SSL verification. "
659
+ f"Attempt: { attempt } /2. Trace: { err } "
656
660
)
657
661
if attempt < 2 :
658
662
return self .get_remote_image_length (
You can’t perform that action at this time.
0 commit comments