From bea781d28fff3b0034841ef8315e24365c06d8c3 Mon Sep 17 00:00:00 2001 From: fathom9x Date: Fri, 23 Oct 2020 12:35:16 -0400 Subject: [PATCH] Fixed output of playlist_tracks example (#594) Co-authored-by: Chris Danger --- CHANGELOG.md | 2 +- examples/playlist_tracks.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 288fa14..0ccc4ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed - +- playlist_tracks example code no longer prints extra characters on final loop iteration - SpotifyException now thrown when a request fails & has no response ( fixes #571, #581 ) ### Changed diff --git a/examples/playlist_tracks.py b/examples/playlist_tracks.py index 3476f87..f6d2b18 100644 --- a/examples/playlist_tracks.py +++ b/examples/playlist_tracks.py @@ -12,9 +12,10 @@ while True: offset=offset, fields='items.track.id,total', additional_types=['track']) - pprint(response['items']) - offset = offset + len(response['items']) - print(offset, "/", response['total']) - + if len(response['items']) == 0: break + + pprint(response['items']) + offset = offset + len(response['items']) + print(offset, "/", response['total']) \ No newline at end of file