mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[PR #526] [MERGED] Add support to search multiple markets at once. #924
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#924
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/spotipy-dev/spotipy/pull/526
Author: @nleroy917
Created: 7/2/2020
Status: ✅ Merged
Merged: 7/3/2020
Merged by: @stephanebruckert
Base:
master← Head:market-search📝 Commits (7)
e67c409Add support to search multiple markets. Pass in a list or ALL to search all markets.e1532a6pep8 formatting and verification with flake82517947work on comments from stephanebruckertbd7ddc3pep8 formatting908150arun autopep8 formattingf87e009fix typod5932e3allow tuple of markets to be passed. Add unit tests for this case📊 Changes
4 files changed (+150 additions, -7 deletions)
View changed files
📝
CHANGELOG.md(+4 -1)📝
spotipy/client.py(+110 -6)📝
spotipy/oauth2.py(+2 -0)📝
tests/integration/test_non_user_endpoints.py(+34 -0)📄 Description
Resolve issue #525
Overview
Detailed
I reformatted the API interface
searchmethod. I did notice that all but one method directly returned the result that comes from theself._getcall, and I wanted to keep this to retain any abstraction, but I couldn't think of a way around it. The newsearchmethod on the Spotify client keeps all original functionality, but I added in some logic to handle if a user passes in a list of markets to search through. In addition, as referenced in #525, I added in the ability to search ALL markets as well as another available parameternthat will stop the searching once a given number of results are found.I really tried to keep the object structure returned from Spotify... So, the final object returned from
searchwhen multiple markets are passed in will be almost identical to the object returned if one market or no markets are passed in.To the best of my knowledge, it is the same, except
hrefnow results in a list ofhrefs used for searching.Performance Issues
As mentioned by @stephanebruckert, this code performs poorly due to looping through http requests, but I can not think of a way around it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.