mirror of
https://github.com/c0de-archive/spotipy.git
synced 2025-01-08 15:42:48 +00:00
UI tweak to oauth example
This commit is contained in:
parent
adfb84df9f
commit
6aa6769e10
@ -3,6 +3,7 @@
|
|||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import spotipy
|
import spotipy
|
||||||
import spotipy.oauth2 as oauth2
|
import spotipy.oauth2 as oauth2
|
||||||
@ -27,7 +28,12 @@ print 'redirect_uri', redirect_uri
|
|||||||
# Oauth flow
|
# Oauth flow
|
||||||
sp_oauth = oauth2.SpotifyOAuth(client_id, client_secret, redirect_uri)
|
sp_oauth = oauth2.SpotifyOAuth(client_id, client_secret, redirect_uri)
|
||||||
auth_url = sp_oauth.get_authorize_url()
|
auth_url = sp_oauth.get_authorize_url()
|
||||||
print "Please navigate here: %s" % auth_url
|
try:
|
||||||
|
subprocess.call(["open", auth_url])
|
||||||
|
print "Opening %s in your browser" % auth_url
|
||||||
|
except:
|
||||||
|
print "Please navigate here: %s" % auth_url
|
||||||
|
|
||||||
response = raw_input("The URL you were redirected to: ")
|
response = raw_input("The URL you were redirected to: ")
|
||||||
code = sp_oauth.parse_response_code(response)
|
code = sp_oauth.parse_response_code(response)
|
||||||
access_token = sp_oauth.get_access_token(code)
|
access_token = sp_oauth.get_access_token(code)
|
||||||
|
Loading…
Reference in New Issue
Block a user