-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null Attributes should not be excluded from the Release Object #129
Comments
Hey @rexovas I tried printing out the raw response from the discogs API and it indeed seems like the print(client._get("https://api.discogs.com/releases/18424870"))
You can use the release.fetch("year")
release.fetch("country") Also does it not work if you access the release.year
release.country This uses the |
Thanks - will give these a try and report back |
Pardon the delay - reporting back. Your suggestion of Regarding the above scenario, for year and country
One thing to note, I did notice slight differences between using fetch or accessing the release properties normally. For example
Whereas release.labels results in:
Just wanted to note that the results are not always the same. Edit: It does seem to work with this other syntax
|
@AnssiAhola are we considering to add things that are actually missing in the API already to the client? If we start to do that, there is no end. Isn't this kind of out of scope? Just thinking out loud if this should be a reasonable feature request or a "works as designed". Or am I mistaken and we return a default value of "None" already when requesting something that is not existing in the API already?
I couldn't figure it out from the discussion above... |
The client uses I'm fine with "works as designed" for now, we can come back to this if it ever comes up. |
I've come across a few instances where, say - the "country" attribute is missing from a release
Take this one for example:
https://www.discogs.com/release/18424870-The-Smashing-Pumpkins-Rotten-Apples-Greatest-Hits
In the case of the missing year, I'm still able to access the year attribute without a KeyError
However when attempting to access the country attribute:
This makes it rather clunky to handle cases where certain attributes are missing - because in some cases after catching a KeyError, I simply need to call
release.refresh()
and the keys may then become accessible (side note, would be nice if I didn't have to call release.refresh())But if the key is truly missing, a value (such as 0 in the case of the year) can convey that.
I'm not sure if this is an api client issue or an issue from Discogs side
The text was updated successfully, but these errors were encountered: