Skip to content

Commit

Permalink
users can now change username on last, so this is more common
Browse files Browse the repository at this point in the history
  • Loading branch information
biancarosa committed Jul 20, 2024
1 parent 3757fe3 commit 35df29a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/app/songs/latest_songs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ def route(user):
try:
req = requests.get(api_url, timeout=TIMEOUT)
lastfm_response = req.json()
log.info("Response received", response=lastfm_response)
try:
track = lastfm_response['recenttracks']['track'][0]
except KeyError:
log.info(f"User likely exist {user}")
return jsonify({
'message': 'USER_LIKELY_DOESNT_EXIST',
}), 404
except IndexError:
return jsonify({
'message': 'NO_TRACKS_FOUND'
Expand Down

0 comments on commit 35df29a

Please sign in to comment.