mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-01-06 14:52:50 +00:00
Merge pull request #173 from shantanugoel/fix_headless_execution
Fix execution on headless systems where webbrowser module may not be available
This commit is contained in:
commit
58029fbb84
@ -5,7 +5,6 @@ from __future__ import print_function
|
|||||||
import os
|
import os
|
||||||
from . import oauth2
|
from . import oauth2
|
||||||
import spotipy
|
import spotipy
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
def prompt_for_user_token(username, scope=None, client_id = None,
|
def prompt_for_user_token(username, scope=None, client_id = None,
|
||||||
client_secret = None, redirect_uri = None, cache_path = None):
|
client_secret = None, redirect_uri = None, cache_path = None):
|
||||||
@ -69,6 +68,7 @@ def prompt_for_user_token(username, scope=None, client_id = None,
|
|||||||
''')
|
''')
|
||||||
auth_url = sp_oauth.get_authorize_url()
|
auth_url = sp_oauth.get_authorize_url()
|
||||||
try:
|
try:
|
||||||
|
import webbrowser
|
||||||
webbrowser.open(auth_url)
|
webbrowser.open(auth_url)
|
||||||
print("Opened %s in your browser" % auth_url)
|
print("Opened %s in your browser" % auth_url)
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user