Flask Adapter
Flask Adapter é um pacote Python que fornece funcionalidades adicionais para integrar Data Transfer Objects (DTOs) em rotas Flask.
Instalação
Instale o Flask Adapter usando o pip:
pip install flask-adapter
Exemplo de Uso
from flask import Flask
from dataclasses import dataclass
from flask_adapter.injection import params
app = Flask(__name__)
@dataclass
class UserDTO:
id: int
name: str
@dataclass
class CreateUserDTO:
username: str
email: str
@app.route("/user", methods=["GET", "POST", "PUT"])
@params(UserDTO, whitelist=False)
def user_controller(user_dto: UserDTO):
return f"User: {user_dto.id}, {user_dto.name}"
@app.route("/create_user", methods=["POST"])
@params(CreateUserDTO)
def create_user_controller(create_user_dto: CreateUserDTO):
return f"Creating user: {create_user_dto.username}, {create_user_dto.email}"
if __name__ == "__main__":
app.run(debug=True)
Metadata
Release files for flask-adapter 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flask-adapter-0.1.4.tar.gz | 2.3 kB | Without provenance | Details |
Release files / flask-adapter-0.1.4.tar.gz
| Download URL | flask-adapter-0.1.4.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cd21f0fefd0ef51b0b33b47d330d5b3407be3446a509d6c94ba28c24b7d364c
|
|
BLAKE2b-256 checksum How to use checksums |
f7a993ded77f6c65fb7d590faad66dbbf29220eae04d4d9dc1314f74a6ba94f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for flask-adapter 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.