Skip to main content

Pagination tools for API Star.

Project description

API Star Pagination

Build Status codecov PyPI version

  • Version: 0.4.0
  • Status: Production/Stable
  • Author: José Antonio Perdiguero López

Pagination tools for API Star.

Features

  • Page number pagination.
  • Limit-offset pagination.

Quick start

Install API star Pagination:

pip install apistar-pagination

Use paginated response in your views:

Page number pagination

from apistar_pagination import PageNumberResponse

def page_number(page: http.QueryParam, page_size: http.QueryParam) -> typing.List[int]:
    collection = range(10)  # Get your whole collection instead of a list of numbers

    return PageNumberResponse(page=page, page_size=page_size, content=collection)

Limit-offset pagination

from apistar_pagination import LimitOffsetResponse

def limit_offset(offset: http.QueryParam, limit: http.QueryParam) -> typing.List[int]:
    collection = range(10)  # Get your whole collection instead of a list of numbers

    return LimitOffsetResponse(offset=offset, limit=limit, content=collection)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for apistar-pagination, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size apistar_pagination-0.4.0-py3-none-any.whl (44.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size apistar-pagination-0.4.0.tar.gz (15.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page