From 5bc3d4b020aaa3280b2a7f864a3e8f20b3d6f4a8 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sun, 21 Nov 2021 16:00:34 +0000 Subject: [PATCH] Fix crash on an empty response This check was a leftover from the resumeKey pagination, where empty responses are supposed to be impossible. With the page pagination, they are possible. --- ia-cdx-search | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ia-cdx-search b/ia-cdx-search index e449480..114c2b9 100755 --- a/ia-cdx-search +++ b/ia-cdx-search @@ -51,7 +51,9 @@ async def wait_first_and_print(tasks): return task = tasks.popleft() url, code, o, connection = await task - assert o, 'got empty response' + if not o: + print(f'Completed processing page {task._ia_cdx_page} (0 results)', file = sys.stderr) + return task._ia_cdx_page, connection fields = o[0] assert all(len(v) == len(fields) for v in o[1:]), 'got unexpected response format' for row in o[1:]: