[GH-ISSUE #48] Error when executing get_playlist_infos(): RequestError: Failed to complete request. #28

Closed
opened 2026-02-27 19:06:31 +03:00 by kerem · 4 comments
Owner

Originally created by @Leogendra on GitHub (Sep 19, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/48

Currently, we're unable to get playlist infos (and other methods I guess).

Minimal code to reproduce the error:

from spotapi import PublicPlaylist

playlist = PublicPlaylist("6zCID88oNjNv9zx6puDHKj")
results = playlist.get_playlist_info()

Full error:

Traceback (most recent call last):
  File "/home/test/test.py", line 40, in <module>
    results = playlist.get_playlist_info()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/playlist.py", line 72, in get_playlist_info
    "sha256Hash": self.base.part_hash("fetchPlaylist"),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/client.py", line 217, in part_hash
    self.get_sha256_hash()
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/client.py", line 234, in get_sha256_hash
    resp = self.client.get(str(self.js_pack))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/http/request.py", line 205, in get
    response = self.build_request("GET", url, allow_redirects=True, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/venv/lib64/python3.12/site-packages/spotapi/http/request.py", line 159, in build_request
    raise RequestError("Failed to complete request.", error=err)
spotapi.exceptions.errors.RequestError: Failed to complete request.
Originally created by @Leogendra on GitHub (Sep 19, 2025). Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/48 Currently, we're unable to get playlist infos (and other methods I guess). Minimal code to reproduce the error: ``` from spotapi import PublicPlaylist playlist = PublicPlaylist("6zCID88oNjNv9zx6puDHKj") results = playlist.get_playlist_info() ``` Full error: ``` Traceback (most recent call last): File "/home/test/test.py", line 40, in <module> results = playlist.get_playlist_info() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/playlist.py", line 72, in get_playlist_info "sha256Hash": self.base.part_hash("fetchPlaylist"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/client.py", line 217, in part_hash self.get_sha256_hash() File "/home/test/venv/lib64/python3.12/site-packages/spotapi/types/annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/client.py", line 234, in get_sha256_hash resp = self.client.get(str(self.js_pack)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/http/request.py", line 205, in get response = self.build_request("GET", url, allow_redirects=True, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/test/venv/lib64/python3.12/site-packages/spotapi/http/request.py", line 159, in build_request raise RequestError("Failed to complete request.", error=err) spotapi.exceptions.errors.RequestError: Failed to complete request. ```
kerem closed this issue 2026-02-27 19:06:31 +03:00
Author
Owner

@Aran404 commented on GitHub (Sep 19, 2025):

Could you expand the error for me? As in access the .error property after catching it. I'll look into it soon

<!-- gh-comment-id:3313182476 --> @Aran404 commented on GitHub (Sep 19, 2025): Could you expand the error for me? As in access the .error property after catching it. I'll look into it soon
Author
Owner

@Leogendra commented on GitHub (Sep 22, 2025):

I tried catching the exception as you suggested.

try:
    results = playlist.get_playlist_info()
except Exception as e:
    print("Message:", e)
    print("Detail:", e.error)

Here’s what it returns:

Message: Failed to complete request.
Detail: no request url or request method provided

So it looks like the request isn’t even being built before sending.
Digging a bit into the code:

The error comes from build_request in spotapi/http/request.py, which fails because it receives no proper url/method. Tracing back, this happens in get_sha256_hash (spotapi/client.py):

resp = self.client.get(str(self.js_pack))

At this point, self.js_pack is still None (or not properly set). Converting it to str gives "None", which explains the no request url or request method provided detail.
self.js_pack is supposed to be set by self.get_session(), but get_session() fails because the expected web-player*.js script can’t be found anymore on https://open.spotify.com.

So essentially, get_playlist_info() ends up trying to call .get("None") instead of a real URL because Spotify changed the structure of their web player, so the library can’t grab the js_pack anymore.

<!-- gh-comment-id:3317680825 --> @Leogendra commented on GitHub (Sep 22, 2025): I tried catching the exception as you suggested. ``` try: results = playlist.get_playlist_info() except Exception as e: print("Message:", e) print("Detail:", e.error) ``` Here’s what it returns: ``` Message: Failed to complete request. Detail: no request url or request method provided ``` So it looks like the request isn’t even being built before sending. Digging a bit into the code: The error comes from `build_request` in `spotapi/http/request.py`, which fails because it receives no proper `url`/`method`. Tracing back, this happens in `get_sha256_hash` (`spotapi/client.py`): ```python resp = self.client.get(str(self.js_pack)) ``` At this point, `self.js_pack` is still `None` (or not properly set). Converting it to `str` gives `"None"`, which explains the `no request url or request method provided` detail. `self.js_pack` is supposed to be set by `self.get_session()`, but `get_session()` fails because the expected `web-player*.js` script can’t be found anymore on `https://open.spotify.com`. So essentially, `get_playlist_info()` ends up trying to call `.get("None")` instead of a real URL because Spotify changed the structure of their web player, so the library can’t grab the `js_pack` anymore.
Author
Owner

@Aran404 commented on GitHub (Sep 22, 2025):

Was a very small fix, they changed their cdn uri.

<!-- gh-comment-id:3320430082 --> @Aran404 commented on GitHub (Sep 22, 2025): Was a very small fix, they changed their cdn uri.
Author
Owner

@Leogendra commented on GitHub (Sep 22, 2025):

Thanks for the quick update!
Don't forget to push the fix to pypi 👍

<!-- gh-comment-id:3321628156 --> @Leogendra commented on GitHub (Sep 22, 2025): Thanks for the quick update! Don't forget to push the fix to pypi 👍
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotAPI#28
No description provided.