From a565b7f15925dd1dfd5d518d8325dedbeea05d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mice=20P=C3=A1pai?= Date: Wed, 26 Apr 2017 01:13:43 +0200 Subject: [PATCH 1/2] Fix: _collect_nodes() break if there are no child nodes --- pylast/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pylast/__init__.py b/pylast/__init__.py index d6ee580..2259649 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -3984,6 +3984,9 @@ def _collect_nodes(limit, sender, method_name, cacheable, params=None): doc = sender._request(method_name, cacheable, params) doc = cleanup_nodes(doc) + # break if there are no child nodes + if not doc.documentElement.childNodes: + break main = doc.documentElement.childNodes[0] if main.hasAttribute("totalPages"): From e19061a437a472e29bc7c82aba3093c7167f0cff Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 25 Sep 2017 14:29:44 +0300 Subject: [PATCH 2/2] Re-enable test for re-added Last.fm API --- tests/test_pylast.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_pylast.py b/tests/test_pylast.py index d6fe823..f636061 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -911,8 +911,7 @@ class TestPyLast(unittest.TestCase): lastfm_user = self.network.get_authenticated_user() # Act/Assert - # Skip the first one because Last.fm API is broken - # self.helper_validate_cacheable(lastfm_user, "get_friends") + self.helper_validate_cacheable(lastfm_user, "get_friends") self.helper_validate_cacheable(lastfm_user, "get_loved_tracks") self.helper_validate_cacheable(lastfm_user, "get_neighbours") self.helper_validate_cacheable(lastfm_user, "get_past_events")