Add1E commited on
Commit
8cde942
·
1 Parent(s): ae9b212

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,6 +11,7 @@ AUTH_URL = "https://accounts.spotify.com/authorize"
11
  TOKEN_URL = "https://accounts.spotify.com/api/token"
12
 
13
 
 
14
  def get_track_audio_features(track_id, access_token):
15
  endpoint = f"https://api.spotify.com/v1/audio-features/{track_id}"
16
  headers = {
@@ -42,9 +43,8 @@ def extract_track_id_from_url(url):
42
 
43
  def app():
44
 
45
-
46
  # Step 1: User Authorization
47
- if st.session_state.get('code') is None or ('access_token' not in st.session_state or st.session_state['access_token'] is None):
48
  auth_params = {
49
  'client_id': CLIENT_ID,
50
  'response_type': 'code',
@@ -68,7 +68,7 @@ def app():
68
  token_r = requests.post(TOKEN_URL, data=token_data)
69
  token_response = token_r.json()
70
  st.session_state['access_token'] = token_response.get('access_token')
71
-
72
  if 'access_token' in st.session_state:
73
  st.write("Enter a Spotify Track URL or URI to get its audio features.")
74
  track_input = st.text_input("Spotify Track URL/URI", "")
 
11
  TOKEN_URL = "https://accounts.spotify.com/api/token"
12
 
13
 
14
+
15
  def get_track_audio_features(track_id, access_token):
16
  endpoint = f"https://api.spotify.com/v1/audio-features/{track_id}"
17
  headers = {
 
43
 
44
  def app():
45
 
 
46
  # Step 1: User Authorization
47
+ if st.session_state.get('code') is None:
48
  auth_params = {
49
  'client_id': CLIENT_ID,
50
  'response_type': 'code',
 
68
  token_r = requests.post(TOKEN_URL, data=token_data)
69
  token_response = token_r.json()
70
  st.session_state['access_token'] = token_response.get('access_token')
71
+
72
  if 'access_token' in st.session_state:
73
  st.write("Enter a Spotify Track URL or URI to get its audio features.")
74
  track_input = st.text_input("Spotify Track URL/URI", "")