mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 04:52:49 +01:00
Deezer: Improve requests error handling (#5421)
This PR adds gracefully handling requests error in teh Deezer plugin.
This commit is contained in:
commit
c13f0f2f6e
2 changed files with 15 additions and 6 deletions
|
|
@ -279,12 +279,20 @@ class DeezerPlugin(MetadataSourcePlugin, BeetsPlugin):
|
|||
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 '{}'",
|
||||
|
|
|
|||
|
|
@ -240,6 +240,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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue