From bf1ef7dfa6d8c98db4041554ba4a87b4a8c400e3 Mon Sep 17 00:00:00 2001 From: Bastien Le Querrec <blq@laquadrature.net> Date: Wed, 6 Mar 2024 16:43:16 +0100 Subject: [PATCH] =?UTF-8?q?ppparis:=20r=C3=A9essaie=20de=20t=C3=A9l=C3=A9c?= =?UTF-8?q?harger=20en=20cas=20d'erreur=20de=20connexion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ppparis.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ppparis.py b/ppparis.py index 1d797c5..2501da2 100755 --- a/ppparis.py +++ b/ppparis.py @@ -50,6 +50,9 @@ def download_file(url, dest): f = open(dest,'wb') f.write(file.content); f.close() + except (requests.ConnectionError, requests.ChunkedEncodingError): + logging.warning(f'ATTENTION: la connexion a été interrompue pendant le téléchargement de {url}, nouvelle tentative...') + download_file(url, dest) except Exception as exc: logging.warning(f'ATTENTION: Impossible de télécharger le fichier {url}: {exc}') -- GitLab