From 00f025dcc9ab2b78defaee1a5e083ecabcecf9df Mon Sep 17 00:00:00 2001 From: derrod Date: Thu, 15 Dec 2022 13:23:17 +0100 Subject: [PATCH] [core] Add timeout and dumb exception handler to manifest download --- legendary/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/legendary/core.py b/legendary/core.py index 4b40cbf..f592794 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -1229,7 +1229,13 @@ class LegendaryCore: for url in manifest_urls: self.log.debug(f'Trying to download manifest from "{url}"...') - r = self.egs.unauth_session.get(url) + try: + r = self.egs.unauth_session.get(url, timeout=10.0) + except Exception as e: + self.log.warning(f'Unable to download manifest from "{urlparse(url).netloc}" ' + f'(Exception: {e!r}), trying next URL...') + continue + if r.status_code == 200: manifest_bytes = r.content break