Skip to main content

PIX Utils

Módulo para validação de chaves PIX e geração de chaves PIX copia-e-cola

Instalação

você pode instalar o módulo usando o comando:

pip install pix-utils

Recursos

Veja alguns dos recursos desta biblioteca:

Validação de chaves PIX.

Valida o tipo de chave chamando o método validate.

from pix_utils import CPF, CNPJ, Email, Phone, Random


print(Phone().validate('11991234567')) # True
print(Email().validate('example@example.com')) # True
print(CPF().validate('12345678901')) # False
print(CNPJ().validate('06.990.590/0001-23')) # True
print(Random().validate('12345678-1234-1234-1234-123456789012')) # True

Formatação de chaves PIX para CPF, CNPJ e telefone.

Máscara chaves PIX de CPF, CNPJ e telefone chamando o método mask.

from pix_utils import CPF, CNPJ, Phone


print(CPF().mask('11438374798')) # 114.383.747-98
print(Phone().mask('11991234567')) # (11) 99123-4567
print(CNPJ().mask('06990590000123')) # 06.990.590/0001-23

Geração de códigos para pagamento PIX estático.

Gera códigos de pagamento estáticos de PIX copia-e-cola.

from pix_utils import Code


KEY = '11438374798' # Chave PIX.
NAME = 'John Doe' # Nome do dono do PIX.
CITY = 'Sao Paulo' # Cidade do dono do PIX. Lembre-se de não usar acentos.
VALUE = 10.00 # Valor da transação.
INDENTIFY = '12345678' # Indentificador da transação (opcional).

print(Code(key=KEY, name=NAME, city=CITY, value=VALUE, identifier=INDENTIFY)) 
# 00020126330014BR.GOV.BCB.PIX011111438374798520400005303986540510.005802BR5908John Doe6009Sao Paulo621205081234567863046A00

Indentificar e formatar chave PIX

Automáticamente Indentifica o tipo de chave PIX e a formata.

from pix_utils import Type


print(Type('11438374798')) # (CPF, '114.383.749-98')
print(Type('11991234567')) # (Phone, '(11) 99123-4567')
print(Type('06990590000123')) # (CNPJ, '06.990.590/0001-23')
print(Type('12345678-1234-1234-1234-123456789012')) # (Random, '12345678-1234-1234-1234-123456789012')
print(Type('example@example.com')) # (Email, example@example.com')

Você pode ver exemplos de usos aqui

Licença

MIT Licence

Metadata

Release files for pix-utils 1.0.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 pix-utils 1.0.1
File Size Uploaded Provenance Actions
pix-utils-1.0.1.tar.gz 6.8 kB Without provenance Details for pix-utils-1.0.1.tar.gz

Release files / pix-utils-1.0.1.tar.gz

Download URL pix-utils-1.0.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
043a34b8ce67ebfab8732a93c224a8d3a645f20f2e96436e9680802d88e176af
BLAKE2b-256 checksum
How to use checksums
c76db5a7456799f1a57fbf54002c91ce952e00cd2c8696420d504774475c9d97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for pix-utils 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

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