Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,17 +54,16 @@ def app():
|
|
| 54 |
st.write('Please log in to Spotify')
|
| 55 |
st.markdown(f"[Log In]({AUTH_URL}?{urlencode(auth_params)})", unsafe_allow_html=True)
|
| 56 |
auth_code = st.session_state['code']
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
st.session_state['access_token'] = token_response.get('access_token')
|
| 68 |
else:#
|
| 69 |
if 'access_token' in st.session_state:
|
| 70 |
st.write("Enter a Spotify Track URL or URI to get its audio features.")
|
|
|
|
| 54 |
st.write('Please log in to Spotify')
|
| 55 |
st.markdown(f"[Log In]({AUTH_URL}?{urlencode(auth_params)})", unsafe_allow_html=True)
|
| 56 |
auth_code = st.session_state['code']
|
| 57 |
+
token_data = {
|
| 58 |
+
'grant_type': 'authorization_code',
|
| 59 |
+
'code': auth_code,
|
| 60 |
+
'redirect_uri': REDIRECT_URI,
|
| 61 |
+
'client_id': CLIENT_ID,
|
| 62 |
+
'client_secret': CLIENT_SECRET,
|
| 63 |
+
}
|
| 64 |
+
token_r = requests.post(TOKEN_URL, data=token_data)
|
| 65 |
+
token_response = token_r.json()
|
| 66 |
+
st.session_state['access_token'] = token_response.get('access_token')
|
|
|
|
| 67 |
else:#
|
| 68 |
if 'access_token' in st.session_state:
|
| 69 |
st.write("Enter a Spotify Track URL or URI to get its audio features.")
|