beets/beetsplug
Alok Saboo f57dc66444 Deezer: Improve requests error handling
## Description

This PR adds gracefully handling requests error in teh Deezer plugin. Right now, it errors out when it receives error:

```bash
Traceback (most recent call last):
  File "/home/arsaboo/.local/bin/beet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/__init__.py", line 1865, in main
    _raw_main(args)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/__init__.py", line 1852, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/commands.py", line 1395, in import_func
    import_files(lib, paths, query)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/commands.py", line 1326, in import_files
    session.run()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 360, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 447, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 195, in coro
    func(*(args + (task,)))
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 1497, in lookup_candidates
    task.lookup_candidates()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 688, in lookup_candidates
    artist, album, prop = autotag.tag_album(
                          ^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/autotag/match.py", line 548, in tag_album
    for matched_candidate in hooks.album_candidates(
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 593, in decorated
    for v in generator(*args, **kwargs):
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/autotag/hooks.py", line 759, in album_candidates
    yield from plugins.candidates(items, artist, album, va_likely, extra_tags)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 390, in candidates
    yield from plugin.candidates(
               ^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 772, in candidates
    results = self._search_api(query_type="album", filters=query_filters)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beetsplug/deezer.py", line 282, in _search_api
    response.raise_for_status()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.deezer.com/search/album?q=album%3A%22Y+Hate+%3F%22+artist%3A%22Parmish+Verma%22
```

## To Do

- [ ] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under `docs/` to describe it.)
- [x] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of one of the lists near the top of the document.)
- [ ] Tests. (Very much encouraged but not strictly required.)
2024-09-15 11:34:29 -04:00
..
bpd Revert "Make queries fast, filter all flexible attributes (#5240)" 2024-06-19 21:51:44 +01:00
lastgenre Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
metasync Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
web Replace py3_path with builtin os.fsdecode 2024-06-16 00:52:37 +01:00
__init__.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
absubmit.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
acousticbrainz.py Codestyle 2024-05-26 11:57:24 -03:00
advancedrewrite.py Merge pull request #5063 from Maxr1998/fix-advancedrewrite-simple-rules 2024-03-01 16:08:37 +10:00
albumtypes.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
aura.py Check Python version instead of catching ImportError 2024-06-22 19:55:52 +03:00
autobpm.py Add Item.filepath property to simplify path handling 2024-08-19 22:44:17 +01:00
badfiles.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
bareasc.py Keep the same FieldQuery.field interface as before 2024-06-17 08:59:20 +01:00
beatport.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
bench.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
bpm.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
bpsync.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
bucket.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
chroma.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
convert.py Use native os.cpu_count 2024-06-16 00:52:38 +01:00
deezer.py Deezer: Improve requests error handling 2024-09-15 11:34:29 -04:00
discogs.py A couple of small updates in the code 2024-06-05 04:41:02 +01:00
duplicates.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
edit.py Use gender-neutral language 2023-10-23 17:41:38 -04:00
embedart.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
embyupdate.py Codestyle 2024-05-26 11:57:24 -03:00
export.py Apply formatting 2024-03-01 15:21:25 +10:00
fetchart.py fetchart, artresizer: Create art files in predictable directories 2024-07-02 15:35:24 +01:00
filefilter.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
fish.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
freedesktop.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
fromfilename.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
ftintitle.py Update log message for keeping artist in ftintitle 2024-09-05 12:28:51 +02:00
fuzzy.py Resolve some 'mypy' errors 2024-06-12 15:58:00 +02:00
gmusic.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
hook.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
ihate.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
importadded.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
importfeeds.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
info.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
inline.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
ipfs.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
keyfinder.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
kodiupdate.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
lastimport.py Update lastimport.py 2023-12-20 10:28:45 -05:00
limit.py Add support for filtering relations 2024-06-21 15:05:29 +01:00
listenbrainz.py Add logging 2023-12-23 12:19:04 -05:00
loadext.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
lyrics.py Filter ending newlines 2024-07-11 15:15:40 +10:00
mbcollection.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
mbsubmit.py mbsubmit: Add picard PromptChoice 2023-12-05 13:49:03 +02:00
mbsync.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
missing.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
mpdstats.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
mpdupdate.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
parentwork.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
permissions.py Apply formatting 2024-03-01 15:21:25 +10:00
play.py test_play: Remove files generated by play plugin 2024-07-02 15:35:24 +01:00
playlist.py Add support for a specific type in InQuery 2024-04-30 22:20:36 +01:00
plexupdate.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
random.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
replaygain.py Use native os.cpu_count 2024-06-16 00:52:38 +01:00
rewrite.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
scrub.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
smartplaylist.py smartplaylist: rename output format m3u8 to extm3u 2024-04-13 04:55:43 +02:00
sonosupdate.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
spotify.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
subsonicplaylist.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
subsonicupdate.py Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
substitute.py A couple of small updates in the code 2024-06-05 04:41:02 +01:00
the.py Resolve some 'mypy' errors 2024-06-12 15:58:00 +02:00
thumbnails.py Replace py3_path with builtin os.fsdecode 2024-06-16 00:52:37 +01:00
types.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00
unimported.py bugfix: ignore subdirectories of ignored 2024-03-22 18:20:47 -04:00
zero.py Apply formatting tools to all files 2023-10-22 09:53:18 +10:00