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, "/")
Release files for fdantic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fdantic-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fdantic-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / fdantic-0.1.0.tar.gz
| Download URL | fdantic-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58a765277c06447bf2acda2c7b0cc2c86b94716d89c720dae73cb5e4c039e3e0
|
|
BLAKE2b-256 checksum How to use checksums |
619220aaa8ad646dedbcb06bc7e56669279b8f4c5b832daae12d70713d6cf416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / fdantic-0.1.0-py3-none-any.whl
| Download URL | fdantic-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09ce7162d2ebb466a861a8405224170df01c58ef4bf754e646352599293f775d
|
|
BLAKE2b-256 checksum How to use checksums |
5a57623f4884863da60fb1574cb443343e9f7db4c432100c7bc75469e7330ef9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|