Bokanovskii commited on
Commit
60022e0
·
1 Parent(s): e886986

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -165,16 +165,22 @@ def create_playlist(sp, img, tracks, playlist_name, privacy):
165
  try:
166
  upload_img()
167
  except spotipy.exceptions.SpotifyException as e:
168
- print(f"Image file too large, couldn't upload: {e}")
 
 
 
 
 
 
169
  except requests.exceptions.ReadTimeout as e:
170
  print(f"Image upload request timeout: {e}")
171
  print("Retrying...")
172
- time.sleep(3)
173
  try:
174
  upload_img()
175
  except Exception as e:
176
  print(e)
177
-
178
  iframe_embedding = f"""<iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/{playlist_id}" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>"""
179
  return iframe_embedding
180
 
 
165
  try:
166
  upload_img()
167
  except spotipy.exceptions.SpotifyException as e:
168
+ print(f"SpotiftException on image upload: {e}")
169
+ print("Retrying")
170
+ time.sleep(5)
171
+ try:
172
+ upload_img()
173
+ except Exception as e:
174
+ print(e)
175
  except requests.exceptions.ReadTimeout as e:
176
  print(f"Image upload request timeout: {e}")
177
  print("Retrying...")
178
+ time.sleep(5)
179
  try:
180
  upload_img()
181
  except Exception as e:
182
  print(e)
183
+ time.sleep(3)
184
  iframe_embedding = f"""<iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/{playlist_id}" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>"""
185
  return iframe_embedding
186