def getAblumInfo(self, url): try: response = requests.get(url).json() albumObj = Album() albumObj.setAlbumName(response["album"]["name"]) albumObj.setArtistName(response["album"]["artist"]) if "wiki" in response["album"]: albumObj.setPublishDate(response["album"]["wiki"]["published"]) elif "tags" in response["album"]: albumObj.setPublishDate( response["album"]["tags"]["tag"][0]["name"]) for x in response["album"]["image"]: if (x["size"] == "large"): albumObj.setImageUrl(x["#text"]) break return albumObj except requests.exceptions.RequestException as e: print("Error.") print(e)