[GH-ISSUE #534] total parameter should refer to all types in search_markets method #319

Closed
opened 2026-02-27 23:21:59 +03:00 by kerem · 2 comments
Owner

Originally created by @stephanebruckert on GitHub (Jul 7, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/534

Currently we can stop searching all markets when an total results are found. However this only applies to the first search type when multiple types are given:

search_markets("abba", type="artist,track", total=10) 

github.com/plamere/spotipy@f7fb8757e9/spotipy/client.py (L541)

Originally created by @stephanebruckert on GitHub (Jul 7, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/534 Currently we can stop searching all markets when an `total` results are found. However this only applies to the first search type when multiple types are given: search_markets("abba", type="artist,track", total=10) https://github.com/plamere/spotipy/blob/f7fb8757e958ee055cf39764ff7070f9d67b7229/spotipy/client.py#L541
kerem 2026-02-27 23:21:59 +03:00
Author
Owner

@quanuw commented on GitHub (Apr 11, 2021):

Hello, I'm new to this project and would like to contribute! Can I be assigned to this issue @stephanebruckert?

<!-- gh-comment-id:817259605 --> @quanuw commented on GitHub (Apr 11, 2021): Hello, I'm new to this project and would like to contribute! Can I be assigned to this issue @stephanebruckert?
Author
Owner

@rngolam commented on GitHub (Nov 27, 2022):

Hi @stephanebruckert, I'm currently looking into this issue and just want to clarify the desired behavior.

The limit parameter specifies the number of items to be returned for each search type. The code will currently truncate the limit as the item count approaches total. But what should happen when multiple types are specified?

For example, if the user enters this query:

search_markets("abba", limit=10, type="artist,track", total=25)

The code will search the first market for 10 artist items followed by 10 track items, bringing the count to 20. At this point, we want to truncate the limit to 5 prior to searching the next market. But should we still get 5 items for both artists and tracks, resulting in a count of 30 items? Or do we just want to get the 5 artists items and immediately return the 25 results at this point (which would result in the second market having no tracks property)?

Thanks!

<!-- gh-comment-id:1328184467 --> @rngolam commented on GitHub (Nov 27, 2022): Hi @stephanebruckert, I'm currently looking into this issue and just want to clarify the desired behavior. The `limit` parameter specifies the number of items to be returned for each search type. The code will currently truncate the limit as the item count approaches `total`. But what should happen when multiple types are specified? For example, if the user enters this query: ``` search_markets("abba", limit=10, type="artist,track", total=25) ``` The code will search the first market for 10 artist items followed by 10 track items, bringing the count to 20. At this point, we want to truncate the limit to 5 prior to searching the next market. But should we still get 5 items for **both** artists and tracks, resulting in a count of 30 items? Or do we just want to get the 5 artists items and immediately return the 25 results at this point (which would result in the second market having no `tracks` property)? Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#319
No description provided.