Merge pull request #139 from delucks/master

Swap use of subprocess.call for webbrowser.open in util.py
This commit is contained in:
Paul Lamere 2016-12-31 07:52:23 -05:00 committed by GitHub
commit 6b39372dca

View File

@ -3,9 +3,9 @@
from __future__ import print_function from __future__ import print_function
import os import os
import subprocess
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): client_secret = None, redirect_uri = None):
@ -67,8 +67,8 @@ 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:
subprocess.call(["open", auth_url]) webbrowser.open(auth_url)
print("Opening %s in your browser" % auth_url) print("Opened %s in your browser" % auth_url)
except: except:
print("Please navigate here: %s" % auth_url) print("Please navigate here: %s" % auth_url)