An unofficial extension to Marshmallow fields and validators for Brazilian documents
Project description
This library provides Marshmallow fields and validators for Brazilian documents:
CNH
CNPJ
CPF
Brazilian birth, marriage and death certificates
Brazilian phone number
Installing
$ pip install marshmallow-br
Usage
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", "11999999999", "+55 (11) 99999-9999", "55 11 99999999"],
}
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',
# '+55 (11) 9999-9999']}
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
marshmallow-br-0.1.0b0.tar.gz
(8.7 kB
view hashes)
Built Distribution
Close
Hashes for marshmallow_br-0.1.0b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25bab32921860d6bfce850d8d18c78fa1f9926c4035d04fee78d7b4b9e292da4 |
|
MD5 | b5aa6f786d9678a019209e5ad68a9778 |
|
BLAKE2b-256 | c85cb28592538f2b12d616fe180de3486b5ef24b9339cf44dc7bdb207521fb5d |