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 details)
Built Distribution
File details
Details for the file fdantic-0.1.0.tar.gz
.
File metadata
- Download URL: fdantic-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a765277c06447bf2acda2c7b0cc2c86b94716d89c720dae73cb5e4c039e3e0 |
|
MD5 | 92e192f215b71e0fb8b97a1f58bf0f3d |
|
BLAKE2b-256 | 619220aaa8ad646dedbcb06bc7e56669279b8f4c5b832daae12d70713d6cf416 |
File details
Details for the file fdantic-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fdantic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09ce7162d2ebb466a861a8405224170df01c58ef4bf754e646352599293f775d |
|
MD5 | e33e6ad704e3910cc66ba047006164ad |
|
BLAKE2b-256 | 5a57623f4884863da60fb1574cb443343e9f7db4c432100c7bc75469e7330ef9 |