Created
January 12, 2026 00:46
-
-
Save leoleoasd/aedd4c3743ea055a5758ba58ad9221b6 to your computer and use it in GitHub Desktop.
Fetch all of your own openreview reviews (including private)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import openreview | |
| def get_base_urls(client): | |
| baseurl_v1 = "http://localhost:3000" | |
| baseurl_v2 = "http://localhost:3001" | |
| if "https://devapi" in client.baseurl: | |
| baseurl_v1 = "https://devapi.openreview.net" | |
| baseurl_v2 = "https://devapi2.openreview.net" | |
| if "https://api" in client.baseurl: | |
| baseurl_v1 = "https://api.openreview.net" | |
| baseurl_v2 = "https://api2.openreview.net" | |
| return [baseurl_v1, baseurl_v2] | |
| def get_own_reviews(client): | |
| baseurl_v1, baseurl_v2 = get_base_urls(client) | |
| client_v1 = openreview.Client(baseurl=baseurl_v1, token=client.token) | |
| client_v2 = openreview.api.OpenReviewClient(baseurl=baseurl_v2, token=client.token) | |
| # Get all the reviews from v1 | |
| notes_v1 = client_v1.get_all_notes(tauthor=True) | |
| submissions_and_official_reviews = [] | |
| # Filter Official Reviews | |
| for note in notes_v1: | |
| # Make sure that the Official Review is public | |
| if 'Official_Review' not in note.invitation or 'everyone' not in note.readers: | |
| continue | |
| submission_id = note.forum | |
| # Make sure that the submission is public | |
| submission = client_v1.get_note(submission_id) | |
| # Add both submission and note | |
| submissions_and_official_reviews.append((submission, note, 1)) | |
| # Get all the reviews from v2 | |
| profile_id = 'Guest' if not getattr(client, 'profile') else getattr(getattr(client, 'profile'), 'id') | |
| if profile_id == 'Guest': | |
| notes_v2 = [] | |
| else: | |
| notes_v2 = client_v2.get_all_notes(signature=profile_id, transitive_members=True) | |
| # TMLR was created before the invitation names were added to the | |
| # group content, so we need to hardcode it | |
| domain_to_reviewer_invitation_suffix = { | |
| 'TMLR': '/-/Review' | |
| } | |
| # Filter Official Reviews | |
| for note in notes_v2: | |
| # Get review invitation name from domain group content | |
| if domain_to_reviewer_invitation_suffix.get(note.domain) is None: | |
| domain = note.domain | |
| group = client_v2.get_group(domain) | |
| reviewer_invitation_suffix = getattr(group, 'content', None) | |
| if group and reviewer_invitation_suffix: | |
| reviewer_invitation_suffix = group.content.get('review_name', {}).get('value', None) | |
| if reviewer_invitation_suffix is None: | |
| continue | |
| domain_to_reviewer_invitation_suffix[domain] = '/-/' + reviewer_invitation_suffix | |
| reviewer_invitation_suffix = domain_to_reviewer_invitation_suffix[note.domain] | |
| # Make sure that the Official Review is public | |
| official_review = None | |
| for invitation in note.invitations: | |
| if reviewer_invitation_suffix in invitation: | |
| official_review = note | |
| if official_review is None: | |
| continue | |
| submission_id = official_review.forum | |
| # Make sure that the submission is public | |
| submission = client_v2.get_note(submission_id) | |
| # Add both submission and note | |
| submissions_and_official_reviews.append((submission, official_review, 2)) | |
| links = [] | |
| for submission, official_review, version in submissions_and_official_reviews: | |
| submission_link = f'https://openreview.net/forum?id={submission.id}' | |
| review_link = f'https://openreview.net/forum?id={submission.id}¬eId={official_review.id}' | |
| submission_title = '' | |
| if version == 1: | |
| submission_title = submission.content.get('title', '') | |
| else: | |
| submission_title = submission.content.get('title', {}).get('value', '') | |
| links.append({ | |
| 'submission_title': submission_title, | |
| 'submission_link': submission_link, | |
| 'review_link': review_link | |
| }) | |
| return links | |
| client = openreview.api.OpenReviewClient( | |
| baseurl='https://api2.openreview.net', | |
| username='your username', | |
| password='your password' | |
| ) | |
| links = get_own_reviews(client) | |
| print(links) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment