Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.13
cache: 'poetry'
Expand Down
1 change: 0 additions & 1 deletion tests/test_backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Offline tests for abuse detection and request backoff (no TIDAL account needed)."""

import datetime
Expand Down
1 change: 0 additions & 1 deletion tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Offline tests for parsing incomplete track and album metadata."""

import pytest
Expand Down
1 change: 0 additions & 1 deletion tests/test_token_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Offline tests for the OAuth token refresh logic (no TIDAL account needed)."""

import datetime
Expand Down
16 changes: 8 additions & 8 deletions tidalapi/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def _refresh_access_token(self, stale_access_token: Optional[str]) -> bool:
"""Refresh the access token, at most once for concurrent callers.

Requests are often issued from several threads (e.g. the paginated workers). If
they all hit an expired token at the same time, each would POST the same
refresh token. TIDAL rotates refresh tokens, so every POST after the first
would use a token that has just been invalidated.
they all hit an expired token at the same time, each would POST the same refresh
token. TIDAL rotates refresh tokens, so every POST after the first would use a
token that has just been invalidated.

:param stale_access_token: The access token the caller's request was sent
with. If the session holds a different one by the time the lock is
acquired, another thread has already refreshed and no new refresh is made.
:param stale_access_token: The access token the caller's request was sent with.
If the session holds a different one by the time the lock is acquired,
another thread has already refreshed and no new refresh is made.
:return: True if the session holds a valid, refreshed access token.
"""
with self._refresh_lock:
Expand Down Expand Up @@ -125,8 +125,8 @@ def _raise_if_backing_off(self) -> None:
def _start_backoff_if_needed(self, response: requests.Response) -> None:
"""Hold back further requests after a rate limit or anti-abuse response.

Requests made while TIDAL is limiting or suspecting the account only prolong
it, and can lead to a permanent ban.
Requests made while TIDAL is limiting or suspecting the account only prolong it,
and can lead to a permanent ban.
"""
if not self.config.backoff:
return
Expand Down
4 changes: 2 additions & 2 deletions tidalapi/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ def login_pkce(self, fn_print: Callable[[str], None] = print) -> None:
# self.client_enable_hires()

def client_enable_hires(self):
"""Swap `config.client_id` and `config.client_secret` for the PKCE pair, which is
the only one entitled to hi-res streams.
"""Swap `config.client_id` and `config.client_secret` for the PKCE pair, which
is the only one entitled to hi-res streams.

The limited input device login (:meth:`login_oauth`) still uses the original
client, as TIDAL rejects the PKCE client on the device authorization endpoint.
Expand Down
Loading