Skip to content

pomponchik/cbfa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Downloads Downloads Coverage Status Hits-of-Code Tests Python versions PyPI version Checked with mypy Ruff

A bit of dummy patching for FastAPI, class-based handlers. So far without self support.

Install it:

$ pip install cbfa

And use:

from typing import Optional from fastapi import FastAPI from pydantic import BaseModel from cbfa import ClassBased app = FastAPI() wrapper = ClassBased(app) class Item(BaseModel): name: str price: float is_offer: Optional[bool] = None @wrapper('/item') class Item: def get(item_id: int, q: Optional[str] = None): return {"item_id": item_id, "q": q} def post(item_id: int, item: Item): return {"item_name": item.name, "item_id": item_id}

About

Class-based views for the FastAPI

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages