cleanup/minor

This commit is contained in:
2025-03-04 08:11:55 -05:00
parent a023868671
commit f29837280a
6 changed files with 103 additions and 46 deletions

View File

@ -3,8 +3,8 @@ import traceback
from typing import Optional, Union
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from .constructors import ValidArtistSearchRequest, ValidAlbumDetailRequest,\
ValidTrackInfoRequest, LastFMException
from .constructors import (ValidArtistSearchRequest, ValidAlbumDetailRequest,
ValidTrackInfoRequest, LastFMException)
class LastFM(FastAPI):
"""Last.FM Endpoints"""
@ -41,7 +41,8 @@ class LastFM(FastAPI):
})
artist_result = await self.lastfm.search_artist(artist=artist)
if not artist_result or "err" in artist_result.keys():
if not artist_result or not artist_result.get('bio')\
or "err" in artist_result.keys():
return JSONResponse(status_code=500, content={
'err': True,
'errorText': 'Search failed (no results?)',