[PR #674] [MERGED] Spurious warning message in auth manager initializers #993

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

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/674
Author: @Peter-Schorn
Created: 4/19/2021
Status: Merged
Merged: 4/19/2021
Merged by: @stephanebruckert

Base: masterHead: master


📝 Commits (1)

  • 9ebb336 Fixed a bug in the initializers for the auth managers that produced a spurious warning message if you provide a cache handler and you set a value for the "SPOTIPY_CLIENT_USERNAME" environment variable.

📊 Changes

2 files changed (+4 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 spotipy/oauth2.py (+3 -4)

📄 Description

If you have your username stored in the "SPOTIPY_CLIENT_USERNAME" environment variable and you create an auth manager and assign a cache handler to it like so (like you should):

auth_manager=SpotifyOAuth(
    scope=scope,
    cache_handler=CacheFileHandler()
)

Then you will get the following error message:

spotipy testing/spotipy/oauth2.py:333: UserWarning: A cache_handler has been specified along with a cache_path or username. The cache_path and username arguments will be ignored.
warnings.warn("A cache_handler has been specified along with a cache_path or " +

This error message should only appear if you pass the username directly to the initializer, not if you happen to have it stored in an environment variable.


🔄 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/674 **Author:** [@Peter-Schorn](https://github.com/Peter-Schorn) **Created:** 4/19/2021 **Status:** ✅ Merged **Merged:** 4/19/2021 **Merged by:** [@stephanebruckert](https://github.com/stephanebruckert) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`9ebb336`](https://github.com/spotipy-dev/spotipy/commit/9ebb33680f7b21a7045ff0aff0bc743de1d9b097) Fixed a bug in the initializers for the auth managers that produced a spurious warning message if you provide a cache handler and you set a value for the "SPOTIPY_CLIENT_USERNAME" environment variable. ### 📊 Changes **2 files changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `spotipy/oauth2.py` (+3 -4) </details> ### 📄 Description If you have your username stored in the "SPOTIPY_CLIENT_USERNAME" environment variable and you create an auth manager and assign a cache handler to it like so (like you should): ```python auth_manager=SpotifyOAuth( scope=scope, cache_handler=CacheFileHandler() ) ``` Then you will get the following error message: > spotipy testing/spotipy/oauth2.py:333: UserWarning: A cache_handler has been specified along with a cache_path or username. The cache_path and username arguments will be ignored. warnings.warn("A cache_handler has been specified along with a cache_path or " + This error message should only appear if you pass the username *directly* to the initializer, not if you happen to have it stored in an environment variable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:03:09 +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#993
No description provided.