carterwward commited on
Commit ·
66825a2
1
Parent(s): 1f6a39b
fix referer typo
Browse files- src/spotipy_utils.py +3 -2
src/spotipy_utils.py
CHANGED
|
@@ -74,7 +74,8 @@ def get_auth_manager() -> spotipy.oauth2.SpotifyOAuth:
|
|
| 74 |
spotipy.oauth2.SpotifyOAuth: Spotipy authentication manager.
|
| 75 |
"""
|
| 76 |
cache_handler = spotipy.cache_handler.MemoryCacheHandler()
|
| 77 |
-
return spotipy.oauth2.SpotifyOAuth(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope=PLAYLIST_SCOPE, redirect_uri=REDIRECT_URL, cache_handler=cache_handler
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
def search_for_track(track, artist):
|
|
@@ -119,7 +120,7 @@ def add_tracks_to_playlist(playlist_name:str, auth_url:str, tracks:List, request
|
|
| 119 |
user_client = spotipy.Spotify(token)
|
| 120 |
elif "referer" in request.headers:
|
| 121 |
auth_manager = get_auth_manager()
|
| 122 |
-
code = auth_manager.parse_response_code(request.headers)
|
| 123 |
token_info = auth_manager.get_access_token(code)
|
| 124 |
user_client = spotipy.Spotify(token_info['access_token'])
|
| 125 |
else:
|
|
|
|
| 74 |
spotipy.oauth2.SpotifyOAuth: Spotipy authentication manager.
|
| 75 |
"""
|
| 76 |
cache_handler = spotipy.cache_handler.MemoryCacheHandler()
|
| 77 |
+
return spotipy.oauth2.SpotifyOAuth(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope=PLAYLIST_SCOPE, redirect_uri=REDIRECT_URL, cache_handler=cache_handler,
|
| 78 |
+
show_dialog=True)
|
| 79 |
|
| 80 |
|
| 81 |
def search_for_track(track, artist):
|
|
|
|
| 120 |
user_client = spotipy.Spotify(token)
|
| 121 |
elif "referer" in request.headers:
|
| 122 |
auth_manager = get_auth_manager()
|
| 123 |
+
code = auth_manager.parse_response_code(request.headers.referer)
|
| 124 |
token_info = auth_manager.get_access_token(code)
|
| 125 |
user_client = spotipy.Spotify(token_info['access_token'])
|
| 126 |
else:
|