Add enhanced URL building and iteration for APIPaginator.

Review Request #10635 — Created July 19, 2019 and submitted

chipx86
Review Board
release-4.0.x
d087898...
reviewboard

APIPaginator is used by hosting services to more easily work with
paginated data from a hosting service, taking care of managing page
data, previous/next URLs, and HTTP requests.

This change enhances the support by taking advantage of the new query=
support for hosting service HTTP requests, allowing callers to more
easily customize their requests in a way that applies to all page
requests, not just the first. This also means the paginator gets to
leverage the cross-Python compatibility already present in the hosting
service's URL building.

New iteration helpers have been added that make it trivial to iterate
through pages of information, or all items across pages. This can be
capped to a maximum number of pages, helping ensure that callers don't
iterate forever (for instance, when iterating through the commit tree in
a repository).

This does change the result of a single GitHub URL, but it's harmless
and only impacts tests. This is due to the ordering code not kicking in,
since it's a fully manually-built URL. A separate change will
standardize URL building for GitHub.

Unit tests pass.

Tested this with some upcoming code that's taking advantage of the new
URL building and iteration helpers.

chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (7b66816)
Loading...