runtime
309 / 500
question 309 HTTP & API Clients · hard

Every open issue, following Link headers

A maintainers' dashboard lists every open issue of a repository from GitHub's API, which pages with Link headers. Write all_issue_titles(opener, url, max_pages=20): request url, keep the titles from the JSON list in the body, and follow the header's rel="next" URL until there is none. Protect the dashboard: raise RuntimeError if a next link points back to a page already fetched, or if more than max_pages pages would be needed.

Simulated: this runs against results recorded on real Python.

Functionall_issue_titles(opener, url, max_pages=20)
Each pagea JSON list of issues ({"number", "title"}); the Link header (if any) may have rel="next"
Returnsevery title in order
RaisesRuntimeError for a next URL that was already fetched, or when page max_pages + 1 would be requested

Loading your progress…

Every open issue, following Link headers — Python practice · Runtime