From f7d52f3d093ab41aba4f6a36533872339c581dee Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 27 Mar 2023 08:22:39 -0300 Subject: [PATCH] [Datasheet dowload] Catch requests.exceptions.TooManyRedirects Closes #408 --- CHANGELOG.md | 2 ++ kibot/out_download_datasheets.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdf0b331..b759afa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `default_resistor_tolerance` which tolerance to use when none found. - `cache_3d_resistors` to avoid generating them all the time. - 3D: colored 3D models for THT resistors +- Datasheet download: + - Avoid interruptions when too many redirections is detected (#408) ### Fixed - Makefile: don't skip all preflights on each run, just the ones we generate diff --git a/kibot/out_download_datasheets.py b/kibot/out_download_datasheets.py index c325b863..870909f9 100644 --- a/kibot/out_download_datasheets.py +++ b/kibot/out_download_datasheets.py @@ -75,6 +75,9 @@ class Download_Datasheets_Options(VariantOptions): except requests.exceptions.SSLError: logger.warning(W_FAILDL+'SSL Error during download `{}`'.format(ds)) return None + except requests.exceptions.TooManyRedirects: + logger.warning(W_FAILDL+'More than 30 redirections downloading `{}`'.format(ds)) + return None if r.status_code != 200: logger.warning(W_FAILDL+'Failed to download `{}`'.format(ds)) return None