Skip to main content

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

$ 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", "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']}

Metadata

Release files for marshmallow-br 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marshmallow-br 0.1.1
File Size Uploaded Provenance Actions
marshmallow-br-0.1.1.tar.gz 8.7 kB Without provenance Details for marshmallow-br-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marshmallow-br 0.1.1
File Interpreter ABI Platform Actions
marshmallow_br-0.1.1-py3-none-any.whl Python 3 none any Details for marshmallow_br-0.1.1-py3-none-any.whl

Total release size: 18.0 kB

Release files / marshmallow-br-0.1.1.tar.gz

Download URL marshmallow-br-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
af46da2cc1d5221155d7cab2a00398deea822cc5589d8eb75b7b51afbfa3baea
BLAKE2b-256 checksum
How to use checksums
ad2af1b53ff67b0173267fa6be117263420fc43b0a0ca7123c36675222ad81fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.9.6 requests/2.28.1 setuptools/65.5.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.10.9

Release files / marshmallow_br-0.1.1-py3-none-any.whl

Download URL marshmallow_br-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae9a15f1be5615e26b1d485409a27e6c3a4300f80562f05949fc317461d08df6
BLAKE2b-256 checksum
How to use checksums
45e74bff5d4713d85fa0e948abee56975a8b11760580c182751fbc9fa9ab2ad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.9.6 requests/2.28.1 setuptools/65.5.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.10.9

Security for marshmallow-br 0.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page