Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.97 KB

README.md

File metadata and controls

63 lines (45 loc) · 1.97 KB

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)