Skip to content

Commit

Permalink
Merge pull request #188 from datalad/no-links
Browse files Browse the repository at this point in the history
Handle lack of Link header when paginating
  • Loading branch information
yarikoptic authored Jan 24, 2024
2 parents 261568b + db3dae6 commit 2de0133
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/datalad_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,11 @@ def paginate(self, url: str, key: Optional[str] = None) -> Iterator[dict]:
for obj in data:
assert isinstance(obj, dict)
yield obj
links = parse_header_links(r.headers.get("Link"))
link_header = r.headers.get("Link")
if link_header is not None:
links = parse_header_links(link_header)
else:
links = {}
url2 = links.get("next", {}).get("url")
if url2 is None:
break
Expand Down

0 comments on commit 2de0133

Please sign in to comment.