Skip to content
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

Issue with dicts that come from search function #127

Open
veljanin opened this issue Feb 27, 2023 · 1 comment
Open

Issue with dicts that come from search function #127

veljanin opened this issue Feb 27, 2023 · 1 comment
Labels
Discogs API Issue Issue lies with the Discogs API, nothing we can do wontfix - works as designed

Comments

@veljanin
Copy link

veljanin commented Feb 27, 2023

Hi everyone!

There seems to be an issue with the dicts that are returned when using .data method on the one of the objects resulting from the search function.

For example, the following few lines of code should print the number of items in the dict:

import discogs_client

client = discogs_client.Client(use_agent="USER_AGENT", user_token="USER_TOKEN")
results = client.search("Daft Punk One more time", type="master")

print(len(results[0].data.items()))
print(len(results[1].data.items()))

And the output of this code is:

>>> 34
>>> 19

Oddly, it sometimes happens that all dict items have 19 key-value pairs, including the first one - without even changing the code.

Moreover, when inspecting these 2 dicts, I notice that the last key in the first result is "embed" while in the second it's "community". And even more importantly for my use case, the "artists" key is missing in the all the results except the first one.

I'm using version 2.6 of the python3-discogs-client package with dedicated conda environment using Python 3.8.

Any help here would be appreciated!

@rexovas
Copy link

rexovas commented May 5, 2023

Yeah, I've been having trouble with this too. For example, sometimes release.data["artists"] will result in a KeyError. For the most part I've been successful calling release.refresh() and then checking for the missing keys again, but I've also come across a few cases where the value was truly blank on the release page (e.g. no country specified)

in which case, the key would remain missing even after calling release.refresh(). This behavior is definitely inconsistent considering some attributes like "year' will return as 0 if they don't have a value. I can only assume this has to do with how they're being stored in the discogs db and how discogs API is returning the data.

See #129

@JOJ0 JOJ0 added wontfix - works as designed Discogs API Issue Issue lies with the Discogs API, nothing we can do labels Sep 4, 2024
@JOJ0 JOJ0 moved this to Todo in python3-discogs-client Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discogs API Issue Issue lies with the Discogs API, nothing we can do wontfix - works as designed
Projects
Development

No branches or pull requests

3 participants