mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[web.controller] improvement: handling http redirect errors
This commit is contained in:
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Web
|
- 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)
|
- 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`)
|
- 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
|
### Fixes
|
||||||
- UI
|
- UI
|
||||||
|
|||||||
@@ -201,13 +201,13 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
def serialize_to_disk(self, pkg: SoftwarePackage, icon_bytes: bytes, only_icon: bool):
|
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)
|
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}
|
headers = {'Accept-language': self._get_lang_header(), 'User-Agent': UA_CHROME}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True, session=False, allow_redirects=True)
|
return self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True, session=False, allow_redirects=True)
|
||||||
except exceptions.ConnectionError as e:
|
except (exceptions.ConnectionError, requests.exceptions.TooManyRedirects) as e:
|
||||||
self.logger.warning("Could not get {}: {}".format(url, e.__class__.__name__))
|
self.logger.warning(f"Could not GET {url}. Exception: {e.__class__.__name__}")
|
||||||
|
|
||||||
def _map_url(self, url: str) -> Tuple["BeautifulSoup", requests.Response]:
|
def _map_url(self, url: str) -> Tuple["BeautifulSoup", requests.Response]:
|
||||||
url_res = self._request_url(url)
|
url_res = self._request_url(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user