This module provides a pagination wrapper for services that support it. Currently only sunlight.congress supports this.

Methods and Constants

class sunlight.pagination.PagingService(service=None, delay=None)[source]

PagingService wraps normal services and iterates over the results of consecutive API calls.

from sunlight import congress
from sunlight.pagination import PagingService

paging_service = PagingService(congress)

print(len(list(paging_service.legislators(limit=55))))   # page more than a single page