[PR #58] [CLOSED] Update client.py #744

Closed
opened 2026-02-28 00:01:27 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/58
Author: @bnlucas
Created: 6/22/2015
Status: Closed

Base: masterHead: patch-1


📝 Commits (1)

📊 Changes

1 file changed (+29 additions, -6 deletions)

View changed files

📝 spotipy/client.py (+29 -6)

📄 Description

.next() and .previous() wouldn't walk through results properly using something like:

sp = spotipy.Spotify()

def get_tracks(artist, locale=None):
    result = sp.search(q=artist, type='album', limit=10, market=locale)

    while True:

        # do something with the results.

        result = sp.next(result['albums'])

        if result is None:
            break

Both methods were update to go off the offset, limit, and total, of result instead of the next url returned.

market was also added as an argument in .search as the API allows to search in a specific market.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/spotipy-dev/spotipy/pull/58 **Author:** [@bnlucas](https://github.com/bnlucas) **Created:** 6/22/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`1646b3e`](https://github.com/spotipy-dev/spotipy/commit/1646b3e50782ca97fc89e7d16f953573e4ffd041) Update client.py ### 📊 Changes **1 file changed** (+29 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `spotipy/client.py` (+29 -6) </details> ### 📄 Description `.next()` and `.previous()` wouldn't walk through results properly using something like: ``` python sp = spotipy.Spotify() def get_tracks(artist, locale=None): result = sp.search(q=artist, type='album', limit=10, market=locale) while True: # do something with the results. result = sp.next(result['albums']) if result is None: break ``` Both methods were update to go off the `offset`, `limit`, and `total`, of `result` instead of the `next` url returned. `market` was also added as an argument in `.search` as the API allows to search in a specific market. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:01:27 +03:00
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#744
No description provided.