Installation
pip install fastapi-paginate
pip install fastapi-paginate[all]
Available integrations:
Example
from fastapi import FastAPI
from pydantic import BaseModel
from fastapi_paginate 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)
This repo is forked from fastapi-pagination.
Although original repository is already good enough, but I modified it according to my needs and published thinking it might be helpful for some.