Skip to main content

Brazilian document validator (CPF or CNPJ) using the check digit

Project description

<h1 class=”code-line” data-line-start=0 data-line-end=1 ><a id=”validdocbr_0”></a>validdocbr</h1> <ul> <li class=”has-line-data” data-line-start=”2” data-line-end=”4”>Document validator (CPF or CNPJ) based on the verification digit.</li> </ul> <p class=”has-line-data” data-line-start=”4” data-line-end=”5”>Installation:</p> <pre><code>pip3 install validdocbr </code></pre> <h1 class=”code-line” data-line-start=8 data-line-end=9 ><a id=”Usage_8”></a>Usage:</h1> <p class=”has-line-data” data-line-start=”9” data-line-end=”10”>Send a CNPJ or CPF as a string, it can contain special characters, returns True if the document is valid or False if it is invalid, using the check digits for the conference.</p> <h1 class=”code-line” data-line-start=11 data-line-end=12 ><a id=”Example_11”></a>Example:</h1> <pre><code class=”has-line-data” data-line-start=”13” data-line-end=”25”>from validdocbr import validdocbr validator = validdocbr.validdocbr()

cpf = &quot;12345678912&quot; cnpj = &quot;98765432112345&quot;

validator.cpf (cpf) —&gt; to validate CPF validator.cnpj (cnpj) —&gt; to validate CNPJ

answer = False —&gt; the document is invalid answer = True —&gt; the document is valid </code></pre> <hr> <hr> <h1 class=”code-line” data-line-start=30 data-line-end=31 ><a id=”validdocbr_30”></a>validdocbr</h1> <ul> <li class=”has-line-data” data-line-start=”32” data-line-end=”34”>Validador de documentos (CPF ou CNPJ) com base no digito verificador.</li> </ul> <h1 class=”code-line” data-line-start=34 data-line-end=35 ><a id=”Istalao_34”></a>Istalação:</h1> <pre><code>pip3 install validdocbr </code></pre> <h1 class=”code-line” data-line-start=38 data-line-end=39 ><a id=”Utilizao_38”></a>Utilização:</h1> <p class=”has-line-data” data-line-start=”39” data-line-end=”40”>Ennvie um CNPJ ou CPF como string, pode conter caracteres especiais, retorna True se documento for válido ou False caso seja inválido, utilizando os digitos verificadores para conferencia.</p> <h1 class=”code-line” data-line-start=41 data-line-end=42 ><a id=”Exemplo_41”></a>Exemplo:</h1> <pre><code class=”has-line-data” data-line-start=”43” data-line-end=”56”>from validdocbr import validdocbr

validator = validdocbr.validdocbr()

cpf = &quot;12345678912&quot; cnpj = &quot;98765432112345&quot;

validador.cpf(cpf) —&gt; para validar CPF validador.cnpj(cnpj) —&gt; para validar CNPJ

resposta = False —&gt; caso documento seja inválido reposta = True —&gt; caso docmunto seja válido </code></pre>

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

validdocbr-1.0.3.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

validdocbr-1.0.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file validdocbr-1.0.3.tar.gz.

File metadata

  • Download URL: validdocbr-1.0.3.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17

File hashes

Hashes for validdocbr-1.0.3.tar.gz
Algorithm Hash digest
SHA256 28d26d992088e6bb67de6c6beb9db9590982233f40b4f56dcedea477ce940081
MD5 2ca5fda6760e74f20df9337c25df9eb9
BLAKE2b-256 2d75499b2241cf4a27e72841998c6d04c9dfbdf94602bf891930d4239442457d

See more details on using hashes here.

Provenance

File details

Details for the file validdocbr-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: validdocbr-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17

File hashes

Hashes for validdocbr-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 98cfa7688e91dc5377a07ae0138ec117b47977d5834b136a6c7186f529c3a92e
MD5 e933fab258a10677757bf1173f69d6cc
BLAKE2b-256 886476199bd6ab2e18fb569037d86176e288326aa7e7c3e1fb2397f683dda6d3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page