Extenção flask para aumento de agilidade de criação de formulario para o flask-restx no processo de criação de projeto.
Project description
FlaskDantic
união de duas lib, flask-restx e pydantic, para facilitar a criação de apis rest com python
from flask import Flask
from flask_dantic import FDantic
from flask_restx import Resource
from pydantic import BaseModel, validator
class Usuario(BaseModel):
id: int
username: str
password: str
app = Flask(__name__)
api = FDantic(app)
np = api.namespace("grupo")
user = np.model_pydantic(Usuario)
class UsuarioResource(Resource):
@user.validate(np)
def post(self):
data: Usuario = self.payload
return data.dict()
np.add_resource(UsuarioResource, "/")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fdantic-0.1.0.tar.gz
(3.4 kB
view hashes)