[PR #574] [MERGED] Allow open_browser to be set on creation of auth_manager (SpotifyOAuth/SpotifyPKCE) #946

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

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/574
Author: @visiblyisabelle
Created: 9/11/2020
Status: Merged
Merged: 9/12/2020
Merged by: @stephanebruckert

Base: masterHead: master


📝 Commits (6)

📊 Changes

4 files changed (+59 additions, -30 deletions)

View changed files

📝 CHANGELOG.md (+3 -1)
📝 FAQ.md (+8 -1)
examples/headless.py (+8 -0)
📝 spotipy/oauth2.py (+40 -28)

📄 Description

This PR fixes #560 (and possibly #572)

One can now instantiate SpotifyOAuth or SpotifyPKCE with open_browser set to False, behaving the same as if you had called get_auth_response(open_browser=False). For backwards compatibility, this defaults to True.

Example:

import spotipy

from spotipy.oauth2 import SpotifyOAuth

oauth = SpotifyOAuth(scope="streaming", open_browser=False)

spotify = spotipy.Spotify(auth_manager=oauth)

if __name__ == "__main__":
    spotify.start_playback()

🔄 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/574 **Author:** [@visiblyisabelle](https://github.com/visiblyisabelle) **Created:** 9/11/2020 **Status:** ✅ Merged **Merged:** 9/12/2020 **Merged by:** [@stephanebruckert](https://github.com/stephanebruckert) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (6) - [`939f869`](https://github.com/spotipy-dev/spotipy/commit/939f869bbc3b8609ec5ba8a00d21b12e9f03b570) Fix plamere/spotipy#560 - [`0905403`](https://github.com/spotipy-dev/spotipy/commit/0905403d21cb572824fcf1428195afce4503794e) Adhere to code style - [`9ab47f3`](https://github.com/spotipy-dev/spotipy/commit/9ab47f32ffbd071fe1bde547d405ef6ca56a1976) Update CHANGELOG.md for changes in 939f869bbc3b8609ec5ba8a00d21b12e9f03b570 - [`df35cb6`](https://github.com/spotipy-dev/spotipy/commit/df35cb632b7abf7228a2c639147fe310a95a9841) open_browser passed to get_auth_response should take precedence over the same argument in the constructor - [`852a55f`](https://github.com/spotipy-dev/spotipy/commit/852a55fa326a8849b24f720ec9cd968ed2e304f6) Update FAQ - [`905b36c`](https://github.com/spotipy-dev/spotipy/commit/905b36cf3f1b5cc760139b39d2ad7ba1a73abeb1) Add headless auth example ### 📊 Changes **4 files changed** (+59 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -1) 📝 `FAQ.md` (+8 -1) ➕ `examples/headless.py` (+8 -0) 📝 `spotipy/oauth2.py` (+40 -28) </details> ### 📄 Description This PR fixes #560 (and possibly #572) One can now instantiate SpotifyOAuth or SpotifyPKCE with `open_browser` set to `False`, behaving the same as if you had called `get_auth_response(open_browser=False)`. For backwards compatibility, this defaults to `True`. Example: ```python import spotipy from spotipy.oauth2 import SpotifyOAuth oauth = SpotifyOAuth(scope="streaming", open_browser=False) spotify = spotipy.Spotify(auth_manager=oauth) if __name__ == "__main__": spotify.start_playback() ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:02:50 +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#946
No description provided.