From 734edbc182ea9b7e67989987bb3b64615db2241d Mon Sep 17 00:00:00 2001
From: Yoann Schneider <yschneider@teklia.com>
Date: Mon, 16 Oct 2023 12:07:06 +0200
Subject: [PATCH] Only retry for 40x

---
 dan/datasets/extract/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dan/datasets/extract/utils.py b/dan/datasets/extract/utils.py
index 5f169c30..fc6e6fb6 100644
--- a/dan/datasets/extract/utils.py
+++ b/dan/datasets/extract/utils.py
@@ -57,7 +57,7 @@ def download_image(url):
     try:
         resp = _retried_request(url)
     except requests.HTTPError as e:
-        if e.response.status_code >= 400:
+        if 400 <= e.response.status_code < 500:
             # Retry with max instead of full as IIIF size
             resp = _retried_request(url.replace("/full/", "/max/"))
         else:
-- 
GitLab