==============
Marshmallow-BR
==============
This library provides `Marshmallow`_ fields and validators for Brazilian documents:
* Brazilian phone number
* Brazilian birth, marriage and death certificates
* CNH (Carteira Nacional de Habilitação)
* CNPJ (Cadastro Nacional da Pessoa Jurídica)
* CPF (Cadastro de Pessoas Físicas)
Installing
----------
.. code-block:: console
$ pip install marshmallow-br
Usage
-----
.. code:: py
from pprint import pprint
from marshmallow import Schema
from marshmallow_br import fields
class Documents(Schema):
certificate = fields.Certificate(mask=True)
cnh = fields.CNH(mask=True)
cnpj = fields.CNPJ(mask=True)
cpf = fields.CPF(mask=True)
phones = fields.List(fields.Phone(mask=True, require_ddi=False, require_ddd=True))
raw_data = {
"certificate": "12173901552014167634174940702955",
"cnh": "64076917022",
"cnpj": "52203670000109",
"cpf": "98008862068",
"phones": ["5511999999999", "11 999999999", "+55(11)99999-9999", "11 9999-9999"],
}
data = Documents().load(raw_data)
pprint(data)
# {'certificate': '121739.01.55.2014.1.67634.174.9407029-55',
# 'cnh': '64076917022',
# 'cnpj': '52.203.670/0001-09',
# 'cpf': '980.088.620-68',
# 'phones': ['+55 (11) 99999-9999',
# '(11) 99999-9999',
# '+55 (11) 99999-9999',
# '(11) 9999-9999']}
.. _`Marshmallow`: https://github.com/marshmallow-code/marshmallow
Raw data
{
"_id": null,
"home_page": "https://github.com/leandcesar/marshmallow-br",
"name": "marshmallow-br",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "serialization,br,brazilian,document,marshal,marshalling,deserialization,validation,schema",
"author": "Leandro C\u00e9sar Cassimiro",
"author_email": "ccleandroc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ad/2a/f1b53ff67b0173267fa6be117263420fc43b0a0ca7123c36675222ad81fd/marshmallow-br-0.1.1.tar.gz",
"platform": null,
"description": "==============\nMarshmallow-BR\n==============\n\nThis library provides `Marshmallow`_ fields and validators for Brazilian documents:\n\n* Brazilian phone number\n* Brazilian birth, marriage and death certificates\n* CNH (Carteira Nacional de Habilita\u00e7\u00e3o)\n* CNPJ (Cadastro Nacional da Pessoa Jur\u00eddica)\n* CPF (Cadastro de Pessoas F\u00edsicas)\n\nInstalling\n----------\n\n.. code-block:: console\n\n $ pip install marshmallow-br\n\nUsage\n-----\n\n.. code:: py\n\n from pprint import pprint\n from marshmallow import Schema\n\n from marshmallow_br import fields\n\n\n class Documents(Schema):\n certificate = fields.Certificate(mask=True)\n cnh = fields.CNH(mask=True)\n cnpj = fields.CNPJ(mask=True)\n cpf = fields.CPF(mask=True)\n phones = fields.List(fields.Phone(mask=True, require_ddi=False, require_ddd=True))\n\n raw_data = {\n \"certificate\": \"12173901552014167634174940702955\",\n \"cnh\": \"64076917022\",\n \"cnpj\": \"52203670000109\",\n \"cpf\": \"98008862068\",\n \"phones\": [\"5511999999999\", \"11 999999999\", \"+55(11)99999-9999\", \"11 9999-9999\"],\n }\n\n data = Documents().load(raw_data)\n pprint(data)\n\n # {'certificate': '121739.01.55.2014.1.67634.174.9407029-55',\n # 'cnh': '64076917022',\n # 'cnpj': '52.203.670/0001-09',\n # 'cpf': '980.088.620-68',\n # 'phones': ['+55 (11) 99999-9999',\n # '(11) 99999-9999',\n # '+55 (11) 99999-9999',\n # '(11) 9999-9999']}\n\n\n.. _`Marshmallow`: https://github.com/marshmallow-code/marshmallow\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "An unofficial extension to Marshmallow fields and validators for Brazilian documents",
"version": "0.1.1",
"split_keywords": [
"serialization",
"br",
"brazilian",
"document",
"marshal",
"marshalling",
"deserialization",
"validation",
"schema"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "45e74bff5d4713d85fa0e948abee56975a8b11760580c182751fbc9fa9ab2ad1",
"md5": "bb3f3994428bed8e718dc3cb1b46f6fd",
"sha256": "ae9a15f1be5615e26b1d485409a27e6c3a4300f80562f05949fc317461d08df6"
},
"downloads": -1,
"filename": "marshmallow_br-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bb3f3994428bed8e718dc3cb1b46f6fd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9259,
"upload_time": "2023-01-12T00:05:18",
"upload_time_iso_8601": "2023-01-12T00:05:18.275474Z",
"url": "https://files.pythonhosted.org/packages/45/e7/4bff5d4713d85fa0e948abee56975a8b11760580c182751fbc9fa9ab2ad1/marshmallow_br-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ad2af1b53ff67b0173267fa6be117263420fc43b0a0ca7123c36675222ad81fd",
"md5": "d721ede283c9cb03e43b0ce7c966e214",
"sha256": "af46da2cc1d5221155d7cab2a00398deea822cc5589d8eb75b7b51afbfa3baea"
},
"downloads": -1,
"filename": "marshmallow-br-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "d721ede283c9cb03e43b0ce7c966e214",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8737,
"upload_time": "2023-01-12T00:05:21",
"upload_time_iso_8601": "2023-01-12T00:05:21.055022Z",
"url": "https://files.pythonhosted.org/packages/ad/2a/f1b53ff67b0173267fa6be117263420fc43b0a0ca7123c36675222ad81fd/marshmallow-br-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-12 00:05:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "leandcesar",
"github_project": "marshmallow-br",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "marshmallow",
"specs": [
[
">=",
"3.0.0b10"
]
]
}
],
"tox": true,
"lcname": "marshmallow-br"
}