Flask-Lan is a modernized api suite with schema validator and auto docs
Project description
Flask-Lan
Flask-Lan
is a modernized flask api builder with schema validator and openapi.
Warning!!!
Currently,
Flask-Lan
is still under active development(before verion 1.0.0). Don't use it in production.
It's kind of like the famous library FastAPI
, bringing part of brilliant features of FastAPI
to your Flask application.
For example, it uses Pydantic for Request/Response params validation
and auto-generates openapi
api docs.
Feature
- Intuitive and easy to use.
- Request/Response validation base on type hinting(by Pydantic).
- Auto-generate
openapi
docs(both swagger and redoc).
Quick start
pip install Flask-Lan
A simple example:
from flask import Flask
from pydantic import BaseModel
from flask_lan import Lan, validator
app = Flask(__name__)
Lan(app, "Book API")
class BookSchema(BaseModel):
title: str
price: float
@app.get("/books/<id>")
@validator
def example(id: int, hi: str, book: BookSchema):
return book.dict()
if __name__ == "__main__":
app.run(debug=True)
Then open http://127.0.0.1:5000/swagger
you will seen the api docs.
License
This project is licensed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flask_lan-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83992ddb3f9a51ee1b5495aefed1027ec4621f88f3d2f0d0d3293a71e1c29567 |
|
MD5 | be87feb254b9f00c31aaf053724f33a6 |
|
BLAKE2b-256 | 7e6c550e22e5f9668983326273d15dcde1a3f4029763509deb0e2445536ccb96 |