From c68b6be2e67a889bf1e50412375715291c4ca2c1 Mon Sep 17 00:00:00 2001 From: Charles Horn Date: Mon, 22 Aug 2022 00:36:39 +0000 Subject: [PATCH 1/2] retry search at current cursor on total:None --- internetarchive/search.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internetarchive/search.py b/internetarchive/search.py index 08a3bc9c..f4ffdc21 100644 --- a/internetarchive/search.py +++ b/internetarchive/search.py @@ -150,6 +150,11 @@ def _scrape(self): j = r.json() if j.get('error'): yield j + if j['total'] is None: + # print('UNEXPECTED RESPONSE:', j) + # Unexpected empty response when iterating on cursor + # Retry with same cursor: + continue num_found = int(j['total']) if not self._num_found: self._num_found = num_found From fce674f7cffdb873bbd94f6f2847b7866b4ac2d3 Mon Sep 17 00:00:00 2001 From: Charles Horn Date: Thu, 1 Sep 2022 09:49:56 +1200 Subject: [PATCH 2/2] remove debug line --- internetarchive/search.py | 1 - 1 file changed, 1 deletion(-) diff --git a/internetarchive/search.py b/internetarchive/search.py index f4ffdc21..0de196ed 100644 --- a/internetarchive/search.py +++ b/internetarchive/search.py @@ -151,7 +151,6 @@ def _scrape(self): if j.get('error'): yield j if j['total'] is None: - # print('UNEXPECTED RESPONSE:', j) # Unexpected empty response when iterating on cursor # Retry with same cursor: continue