diff --git a/CHANGELOG.md b/CHANGELOG.md index 2876ffd6..444334e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Web - able to specify a custom User-Agent when installing apps that demand specific settings to work properly on Electron 13.X (e.g: WhatsApp Web) - checking for javascript fixes based on the Electron version (saved on disk as `~/.local/share/bauh/web/fixes/electron_{branch}/{app_name}.js`) + - handling http redirect errors ### Fixes - UI diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index 21f1af6f..dbaeff8f 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -201,13 +201,13 @@ class WebApplicationManager(SoftwareManager): def serialize_to_disk(self, pkg: SoftwarePackage, icon_bytes: bytes, only_icon: bool): super(WebApplicationManager, self).serialize_to_disk(pkg=pkg, icon_bytes=None, only_icon=False) - def _request_url(self, url: str) -> Response: + def _request_url(self, url: str) -> Optional[Response]: headers = {'Accept-language': self._get_lang_header(), 'User-Agent': UA_CHROME} try: return self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True, session=False, allow_redirects=True) - except exceptions.ConnectionError as e: - self.logger.warning("Could not get {}: {}".format(url, e.__class__.__name__)) + except (exceptions.ConnectionError, requests.exceptions.TooManyRedirects) as e: + self.logger.warning(f"Could not GET {url}. Exception: {e.__class__.__name__}") def _map_url(self, url: str) -> Tuple["BeautifulSoup", requests.Response]: url_res = self._request_url(url)