diff --git a/beetsplug/deezer.py b/beetsplug/deezer.py index a861ea0e45..70ebe8a92a 100644 --- a/beetsplug/deezer.py +++ b/beetsplug/deezer.py @@ -279,12 +279,20 @@ def _search_api(self, query_type, filters=None, keywords=""): if not query: return None self._log.debug(f"Searching {self.data_source} for '{query}'") - response = requests.get( - self.search_url + query_type, - params={"q": query}, - timeout=10, - ) - response.raise_for_status() + try: + response = requests.get( + self.search_url + query_type, + params={"q": query}, + timeout=10, + ) + response.raise_for_status() + except requests.exceptions.RequestException as e: + self._log.error( + "Error fetching data from {} API\n Error: {}", + self.data_source, + e, + ) + return None response_data = response.json().get("data", []) self._log.debug( "Found {} result(s) from {} for '{}'", diff --git a/docs/changelog.rst b/docs/changelog.rst index 24cc395380..39ca787d56 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -238,6 +238,7 @@ New features: Bug fixes: +* :doc:`/plugins/deezer`: Improve requests error handling. * :doc:`/plugins/lastimport`: Improve error handling in the `process_tracks` function and enable it to be used with other plugins. * :doc:`/plugins/spotify`: Improve handling of ConnectionError. * :doc:`/plugins/deezer`: Improve Deezer plugin error handling and set requests timeout to 10 seconds.