Skip to content

Null Attributes should not be excluded from the Release Object #129

@rexovas

Description

@rexovas

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

>>> release.data["year"]
0

However when attempting to access the country attribute:

release.data["country"]
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
KeyError: 'country'

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions