# FlaskDantic
união de duas lib, flask-restx e pydantic, para facilitar a criação de apis rest com python
```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, "/")
````
Raw data
{
"_id": null,
"home_page": "https://github.com/feiticeiro-tec/feiticeiro-tec",
"name": "fdantic",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Pacote",
"author": "Silvio Henrique Cruz Da Silva",
"author_email": "silviohenriquecruzdasilva@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/61/92/20aaa8ad646dedbcb06bc7e56669279b8f4c5b832daae12d70713d6cf416/fdantic-0.1.0.tar.gz",
"platform": null,
"description": "# FlaskDantic\nuni\u00e3o de duas lib, flask-restx e pydantic, para facilitar a cria\u00e7\u00e3o de apis rest com python\n\n```python\n\nfrom flask import Flask\nfrom flask_dantic import FDantic\nfrom flask_restx import Resource\nfrom pydantic import BaseModel, validator\n\nclass Usuario(BaseModel):\n id: int\n username: str\n password: str\n\napp = Flask(__name__)\napi = FDantic(app)\n\nnp = api.namespace(\"grupo\")\nuser = np.model_pydantic(Usuario)\n\n\nclass UsuarioResource(Resource):\n @user.validate(np)\n def post(self):\n data: Usuario = self.payload\n return data.dict()\n\n\nnp.add_resource(UsuarioResource, \"/\")\n````\n",
"bugtrack_url": null,
"license": "BSD3",
"summary": "Exten\u00e7\u00e3o flask para aumento de agilidade de cria\u00e7\u00e3o de formulario para o flask-restx no processo de cria\u00e7\u00e3o de projeto.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/feiticeiro-tec/feiticeiro-tec"
},
"split_keywords": [
"pacote"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5a57623f4884863da60fb1574cb443343e9f7db4c432100c7bc75469e7330ef9",
"md5": "e33e6ad704e3910cc66ba047006164ad",
"sha256": "09ce7162d2ebb466a861a8405224170df01c58ef4bf754e646352599293f775d"
},
"downloads": -1,
"filename": "fdantic-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e33e6ad704e3910cc66ba047006164ad",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3869,
"upload_time": "2023-08-26T02:37:19",
"upload_time_iso_8601": "2023-08-26T02:37:19.240242Z",
"url": "https://files.pythonhosted.org/packages/5a/57/623f4884863da60fb1574cb443343e9f7db4c432100c7bc75469e7330ef9/fdantic-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "619220aaa8ad646dedbcb06bc7e56669279b8f4c5b832daae12d70713d6cf416",
"md5": "92e192f215b71e0fb8b97a1f58bf0f3d",
"sha256": "58a765277c06447bf2acda2c7b0cc2c86b94716d89c720dae73cb5e4c039e3e0"
},
"downloads": -1,
"filename": "fdantic-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "92e192f215b71e0fb8b97a1f58bf0f3d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3432,
"upload_time": "2023-08-26T02:37:20",
"upload_time_iso_8601": "2023-08-26T02:37:20.997778Z",
"url": "https://files.pythonhosted.org/packages/61/92/20aaa8ad646dedbcb06bc7e56669279b8f4c5b832daae12d70713d6cf416/fdantic-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-26 02:37:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "feiticeiro-tec",
"github_project": "feiticeiro-tec",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "fdantic"
}