Skip to content

Commit 71abda9

Browse files
committed
handle pagination of /api/datasets endpoint
1 parent b860c0b commit 71abda9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

promptsource/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ def filter_english_datasets():
109109

110110
response = requests.get("https://huggingface.co/api/datasets?full=true")
111111
tags = response.json()
112+
while "next" in response.links:
113+
# Handle pagination of `/api/datasets` endpoint
114+
response = requests.get(response.links["next"]["url"])
115+
tags += response.json()
112116

113117
for dataset in tags:
114118
dataset_name = dataset["id"]

0 commit comments

Comments
 (0)