Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set openalex to retrieve 50 DOIs per batch #75

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rialto_airflow/harvest/openalex.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ def publications_csv(dois: list, csv_file: str) -> None:
writer.writerow(pub)


def publications_from_dois(dois: list, batch_size=75):
def publications_from_dois(dois: list):
"""
Look up works by DOI in batches that fit within OpenAlex request size limits
"""
for doi_batch in batched(dois, batch_size):
for doi_batch in batched(dois, 50):
# Setting batch size to 50 to avoid 400 errors from OpenAlex API when GET query string is greater than 4096 characters
# Based on experimentation, 75 is too high. 50 is the default per_page size, so we could consider removing pagination in the future.
# TODO: do we need this to stay within 100,000 requests / day API quota?
time.sleep(1)

Expand Down
Loading