#3570·PyGithub

Expose REST response metadata on PaginatedList

Author: janeklbCreated Sep 5, 2026Updated Sep 5, 2026

Problem

Github.search_code() returns a PaginatedList, but callers cannot access response metadata for the pages being iterated through a public API. In particular, code-search clients need the X-RateLimit-Remaining, X-RateLimit-Reset, and X-RateLimit-Resource values from the search response.

Github.get_rate_limit().resources.search exposes the separate /rate_limit resource, but it does not expose metadata from the individual request being iterated. Accessing the requester's headers requires private attributes.

Use case

A caller iterating a code-search result needs to stop before requesting another page after the current response exhausts its search quota. It also needs an actionable reset time to report to the user.

Proposal

Expose supported read-only response metadata on PaginatedList, updated as each REST page is fetched. A property for rate-limit metadata would cover this use case; a documented last-response-header property could support broader endpoint metadata needs.

The exact public shape is open to maintainers' preference. The important part is avoiding reliance on private requester internals.