Skip to content

nikstuckenbrock/fastapi-pagination

 
 

Repository files navigation

FastAPI Pagination

License codecov codecov Downloads PYPI PYPI Support me on Patreon

Installation

# Basic version
pip install fastapi-pagination

# All available integrations
pip install fastapi-pagination[all]

Available integrations:

Example

from fastapi import FastAPI
from pydantic import BaseModel

from fastapi_pagination import Page, add_pagination, paginate

app = FastAPI()


class User(BaseModel):
    name: str
    surname: str


users = [
    User(name='Yurii', surname='Karabas'),
    # ...
]


@app.get('/users', response_model=Page[User])
async def get_users():
    return paginate(users)


add_pagination(app)

Packages

No packages published

Languages

  • Python 100.0%