Uma biblioteca python com modelos de validação para os principais documentos brasileiros
Project description
Pydantic BR Validator
Uma biblioteca python com modelos de validação para os principais documentos brasileiros.
Instalação
pip install pydantic-br-validator
Campos disponíveis
CPF
from pprint import pprint
from pydantic import BaseModel
from pydantic_br_validator import CPF, CPFDigits, CPFMask
class Cliente(BaseModel):
nome: str
cpf: CPF # aceita CPF válidos com ou sem máscara
cpf_mask: CPFMask # aceita CPF válido apenas com máscara
cpf_digits: CPFDigits # aceita CPF válido apenas com dígitos
cliente = Cliente(
nome="Hudson", cpf="04120039021", cpf_mask="041.200.390-21", cpf_digits="04120039021"
)
pprint(cliente.dict())
CNPJ
from pprint import pprint
from pydantic import BaseModel
from pydantic_br_validator import CNPJ, CNPJDigits, CNPJMask
class Cliente(BaseModel):
nome: str
cnpj: CNPJ # aceita CNPJ válidos com ou sem máscara
cnpj_mask: CNPJMask # aceita CNPJ válido apenas com máscara
cnpj_digits: CNPJDigits # aceita CNPJ válido apnas com dígitos
cliente = Cliente(
nome="Hudson", cnpj="47895328000187", cnpj_mask="47.895.328/0001-87", cnpj_digits="47895328000187"
)
pprint(cliente.dict())
Contribua 🚀
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydantic_br_validator-0.3.0.tar.gz
.
File metadata
- Download URL: pydantic_br_validator-0.3.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73cc1673f7609a46253b945ac86ae40d6610f5071dca19b8208f16a04691f07a |
|
MD5 | c96ad12f20f6eca36dd035979e06d548 |
|
BLAKE2b-256 | cb36577d3c466d98a3b985972ed83b0cece4cd092670cce7963ebc17f3eaa2be |
File details
Details for the file pydantic_br_validator-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pydantic_br_validator-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 953b870fd050a38def43f606cef0a2f88b636e64cc9f1e61e14f8546d1b11fcf |
|
MD5 | 778acad8e532fad20611c836ff02823e |
|
BLAKE2b-256 | ba3f64e8771f6a6b88a0ee12eba8160170daa9cabc8b2f8964f80defdb11e1e6 |