[PR #109] [MERGED] Get new access token 60 seconds before old one times out #773

Closed
opened 2026-02-28 00:01:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/109
Author: @lwoloszy
Created: 7/27/2016
Status: Merged
Merged: 12/31/2016
Merged by: @plamere

Base: masterHead: master


📝 Commits (1)

  • ff7b0f3 get new access token ~60 seconds before old one times out

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 spotipy/oauth2.py (+1 -1)

📄 Description

On prolonged interactions with the Spotify API, I was running into token timeout errors. I think this was due to the gap between _is_token_expired call and the subsequent GET request sometimes being longer than the time left before token expiry. Returning True if the number of seconds between token timeout and current time was less than 60 solved the problem.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/spotipy-dev/spotipy/pull/109 **Author:** [@lwoloszy](https://github.com/lwoloszy) **Created:** 7/27/2016 **Status:** ✅ Merged **Merged:** 12/31/2016 **Merged by:** [@plamere](https://github.com/plamere) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`ff7b0f3`](https://github.com/spotipy-dev/spotipy/commit/ff7b0f3e2a42fb7c3db050d0461d567aae5e2222) get new access token ~60 seconds before old one times out ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `spotipy/oauth2.py` (+1 -1) </details> ### 📄 Description On prolonged interactions with the Spotify API, I was running into token timeout errors. I think this was due to the gap between `_is_token_expired` call and the subsequent GET request sometimes being longer than the time left before token expiry. Returning True if the number of seconds between token timeout and current time was less than 60 solved the problem. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:01:38 +03:00
Sign in to join this conversation.
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/spotipy#773
No description provided.