From c6f74118d677806d0287d02b1990917d9e28e477 Mon Sep 17 00:00:00 2001 From: Max Murshed Date: Wed, 5 Aug 2026 18:35:18 -0700 Subject: [PATCH] coauthor_counts: paginate manually to avoid KeyError 'count' crash client.get_all_notes() delegates to tools.concurrent_get(), which first fires a with_count=True, limit=1 probe and unpacks response.json()['count']. Against api2.openreview.net the notes response for this query carries no 'count' field (observed 2026-08-05 with openreview-py 1.27.3), so the script crashes at startup: File ".../openreview/api/client.py", line 1024, in get_notes return notes, response.json()['count'] KeyError: 'count' Replace the call with plain offset pagination via client.get_notes(), which needs no count probe. Behaviour is otherwise identical; verified against a live author profile (returns the correct submission list). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01YamLghkWSvYw1NzBhGChFf --- src/coauthor_counts.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/coauthor_counts.py b/src/coauthor_counts.py index 844fe3a..c1996b1 100644 --- a/src/coauthor_counts.py +++ b/src/coauthor_counts.py @@ -110,6 +110,23 @@ def fetch_profile(client, tilde_id): return profiles[0] if profiles else None +def get_all_notes_paged(client, **params): + """Drop-in for client.get_all_notes(). + + get_all_notes() probes the total via a with_count=True request and crashes + (KeyError: 'count') when the server response carries no 'count' field + (observed with openreview-py 1.27.3 against api2, 2026-08). Plain offset + pagination needs no count. + """ + notes, offset, limit = [], 0, 1000 + while True: + batch = client.get_notes(offset=offset, limit=limit, **params) + notes.extend(batch) + if len(batch) < limit: + return notes + offset += limit + + def main(): # --- 1. Log in ------------------------------------------------------------- login_email = input("OpenReview login email: ").strip() @@ -141,7 +158,7 @@ def main(): # (permission-aware); keep the TMLR submissions. get_all_notes() paginates. tmlr_notes = {} for tilde_id in my_tilde_ids: - for note in client.get_all_notes(content={"authorids": tilde_id}): + for note in get_all_notes_paged(client, content={"authorids": tilde_id}): if any(inv.startswith(TMLR_SUBMISSION_INVITATION) for inv in note_invitations(note)): tmlr_notes[note.id] = note