joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
299 stars 49 forks source link

Returned number of search items do not match the count attribute of the class #126

Open veljanin opened 1 year ago

veljanin commented 1 year ago

Hi everyone!

I've noticed that the number of returned results from the search function doesn't match the count attribute of the class. For example, the following code:

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")
search_results_dicts = [result.data for result in results]

print(results.count == len(search_results_dicts))
print(results.count)
print(len(search_results_dicts))

would return:

>>> False
>>> 82
>>> 80

Interestingly, if you actually go to the Discogs webpage (in this case, that would be: https://www.discogs.com/search/?q=Daft+Punk+One+more+time&type=master) you will notice that the count specified is indeed 82 but if you count the items, you would only get to 80. On the first page, you will see 1 out of 50 although there are only 48 items (6 items per row in 8 rows on PC) and the second one that has 32 items (from 51 to 82) and with the correct count. Therefore, I believe that this comes from the Discogs API rather than the package itself.

Hope this help with further development!

JOJ0 commented 1 year ago

Hi and thanks for the detailed report. That is indeed very interesing 😮

To confirm your assumption that this is returned by api.discogs.com already, have you tried using a low level tool like curl and compared with that result as well?

JensDollenbacher commented 1 year ago

I have observed the same behaviour with object Master. Calling the "refresh" method makes the missing data (artists) available and solves the problem.