[GH-ISSUE #37] BaseClientError: Could not get session auth tokens #23

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

Originally created by @invzfnc on GitHub (Jun 29, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/37

Version

  • Python 3.11.4
  • spotapi==1.1.9

Code to reproduce the error

from spotapi import Public

result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs"))

Result

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "main.py", line 3, in <module>
    result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs"))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\public.py", line 81, in playlist_info
    yield from playlist.paginate_playlist()
  File "venv\Lib\site-packages\spotapi\playlist.py", line 96, in paginate_playlist
    playlist = self.get_playlist_info(limit=UPPER_LIMIT)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\playlist.py", line 72, in get_playlist_info
    "sha256Hash": self.base.part_hash("fetchPlaylist"),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\client.py", line 181, in part_hash
    self.get_sha256_hash()
  File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\client.py", line 193, in get_sha256_hash
    self.get_session()
  File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\client.py", line 134, in get_session
    self._get_auth_vars()
  File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\spotapi\client.py", line 113, in _get_auth_vars
    raise BaseClientError(
spotapi.exceptions.errors.BaseClientError: Could not get session auth tokens

Expected behavior
playlist_info should return playlist details without errors.

Originally created by @invzfnc on GitHub (Jun 29, 2025). Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/37 **Version** - Python 3.11.4 - `spotapi==1.1.9` **Code to reproduce the error** ```python from spotapi import Public result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs")) ``` **Result** ``` Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "main.py", line 3, in <module> result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\public.py", line 81, in playlist_info yield from playlist.paginate_playlist() File "venv\Lib\site-packages\spotapi\playlist.py", line 96, in paginate_playlist playlist = self.get_playlist_info(limit=UPPER_LIMIT) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\playlist.py", line 72, in get_playlist_info "sha256Hash": self.base.part_hash("fetchPlaylist"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\client.py", line 181, in part_hash self.get_sha256_hash() File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\client.py", line 193, in get_sha256_hash self.get_session() File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\client.py", line 134, in get_session self._get_auth_vars() File "venv\Lib\site-packages\spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "venv\Lib\site-packages\spotapi\client.py", line 113, in _get_auth_vars raise BaseClientError( spotapi.exceptions.errors.BaseClientError: Could not get session auth tokens ``` **Expected behavior** `playlist_info` should return playlist details without errors.
kerem closed this issue 2026-02-27 19:06:29 +03:00
Author
Owner

@invzfnc commented on GitHub (Jun 29, 2025):

Extra info: The code seems to be throwing the exception only when spotapi is installed with pip. It works fine with the files in the repository.

<!-- gh-comment-id:3016401765 --> @invzfnc commented on GitHub (Jun 29, 2025): Extra info: The code seems to be throwing the exception only when spotapi is installed with pip. It works fine with the files in the repository.
Author
Owner

@Aran404 commented on GitHub (Jun 30, 2025):

Is PyPi up to date? I'm not too sure if I'm being honest

<!-- gh-comment-id:3021124924 --> @Aran404 commented on GitHub (Jun 30, 2025): Is PyPi up to date? I'm not too sure if I'm being honest
Author
Owner

@invzfnc commented on GitHub (Jun 30, 2025):

Just checked. It says 1.1.9 on PyPI.

<!-- gh-comment-id:3021193714 --> @invzfnc commented on GitHub (Jun 30, 2025): Just checked. It says 1.1.9 on PyPI.
Author
Owner

@Aran404 commented on GitHub (Jun 30, 2025):

Should be UTD then?

<!-- gh-comment-id:3021208424 --> @Aran404 commented on GitHub (Jun 30, 2025): Should be UTD then?
Author
Owner

@invzfnc commented on GitHub (Jul 1, 2025):

I think so. But why is it throwing error then?

<!-- gh-comment-id:3021222390 --> @invzfnc commented on GitHub (Jul 1, 2025): I think so. But why is it throwing error then?
Author
Owner

@invzfnc commented on GitHub (Jul 1, 2025):

Just tested again with the code directly from GitHub. It's broken again. I think it might be related to #38
The traceback, in case you need it:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "main.py", line 3, in <module>
    result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs"))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\public.py", line 81, in playlist_info
    yield from playlist.paginate_playlist()
  File "spotapi\playlist.py", line 96, in paginate_playlist
    playlist = self.get_playlist_info(limit=UPPER_LIMIT)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\playlist.py", line 72, in get_playlist_info
    "sha256Hash": self.base.part_hash("fetchPlaylist"),
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\client.py", line 182, in part_hash
    self.get_sha256_hash()
  File "spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\client.py", line 194, in get_sha256_hash
    self.get_session()
  File "spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\client.py", line 135, in get_session
    self._get_auth_vars()
  File "spotapi\types\annotations.py", line 47, in wrapper
    result: R = func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^
  File "spotapi\client.py", line 114, in _get_auth_vars
    raise BaseClientError(
spotapi.exceptions.errors.BaseClientError: Could not get session auth tokens
<!-- gh-comment-id:3021287764 --> @invzfnc commented on GitHub (Jul 1, 2025): Just tested again with the code directly from GitHub. It's broken again. I think it might be related to #38 The traceback, in case you need it: ``` Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "main.py", line 3, in <module> result = next(Public.playlist_info("16tsE24qp7IeWHxARnF8Zs")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "spotapi\public.py", line 81, in playlist_info yield from playlist.paginate_playlist() File "spotapi\playlist.py", line 96, in paginate_playlist playlist = self.get_playlist_info(limit=UPPER_LIMIT) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "spotapi\playlist.py", line 72, in get_playlist_info "sha256Hash": self.base.part_hash("fetchPlaylist"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "spotapi\client.py", line 182, in part_hash self.get_sha256_hash() File "spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "spotapi\client.py", line 194, in get_sha256_hash self.get_session() File "spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "spotapi\client.py", line 135, in get_session self._get_auth_vars() File "spotapi\types\annotations.py", line 47, in wrapper result: R = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "spotapi\client.py", line 114, in _get_auth_vars raise BaseClientError( spotapi.exceptions.errors.BaseClientError: Could not get session auth tokens ```
Author
Owner

@Aran404 commented on GitHub (Jul 8, 2025):

Should be fixed now

<!-- gh-comment-id:3049873737 --> @Aran404 commented on GitHub (Jul 8, 2025): Should be fixed now
Author
Owner

@girwin1 commented on GitHub (Jul 10, 2025):

Broken again

<!-- gh-comment-id:3057198691 --> @girwin1 commented on GitHub (Jul 10, 2025): Broken again
Author
Owner

@invzfnc commented on GitHub (Jul 10, 2025):

I think it's better if you open a new issue for this.

<!-- gh-comment-id:3057510608 --> @invzfnc commented on GitHub (Jul 10, 2025): I think it's better if you open a new issue for this.
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#23
No description provided.