pix-utils


Namepix-utils JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/Gustavosta/pix-utils
SummaryA module for useful functions related to the Brazilian payment system PIX.
upload_time2022-12-21 17:52:34
maintainer
docs_urlNone
authorGustavo Santana
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
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`.

```python
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`.

```python
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.

```python
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.

```python
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](/examples)

## Licença

[MIT Licence](LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Gustavosta/pix-utils",
    "name": "pix-utils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Gustavo Santana",
    "author_email": "sowlfie@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c7/6d/b5a7456799f1a57fbf54002c91ce952e00cd2c8696420d504774475c9d97/pix-utils-1.0.1.tar.gz",
    "platform": null,
    "description": "# PIX Utils\r\n\r\nM\u00f3dulo para valida\u00e7\u00e3o de chaves PIX e gera\u00e7\u00e3o de chaves PIX copia-e-cola\r\n\r\n## Instala\u00e7\u00e3o\r\n\r\nvoc\u00ea pode instalar o m\u00f3dulo usando o comando:\r\n\r\n```bash\r\npip install pix-utils\r\n```\r\n\r\n## Recursos\r\n\r\nVeja alguns dos recursos desta biblioteca:\r\n\r\n### Valida\u00e7\u00e3o de chaves PIX.\r\n\r\nValida o tipo de chave chamando o m\u00e9todo `validate`.\r\n\r\n```python\r\nfrom pix_utils import CPF, CNPJ, Email, Phone, Random\r\n\r\n\r\nprint(Phone().validate('11991234567')) # True\r\nprint(Email().validate('example@example.com')) # True\r\nprint(CPF().validate('12345678901')) # False\r\nprint(CNPJ().validate('06.990.590/0001-23')) # True\r\nprint(Random().validate('12345678-1234-1234-1234-123456789012')) # True\r\n```\r\n\r\n### Formata\u00e7\u00e3o de chaves PIX para CPF, CNPJ e telefone.\r\n\r\nM\u00e1scara chaves PIX de CPF, CNPJ e telefone chamando o m\u00e9todo `mask`.\r\n\r\n```python\r\nfrom pix_utils import CPF, CNPJ, Phone\r\n\r\n\r\nprint(CPF().mask('11438374798')) # 114.383.747-98\r\nprint(Phone().mask('11991234567')) # (11) 99123-4567\r\nprint(CNPJ().mask('06990590000123')) # 06.990.590/0001-23\r\n```\r\n\r\n### Gera\u00e7\u00e3o de c\u00f3digos para pagamento PIX est\u00e1tico.\r\n\r\nGera c\u00f3digos de pagamento est\u00e1ticos de PIX copia-e-cola.\r\n\r\n```python\r\nfrom pix_utils import Code\r\n\r\n\r\nKEY = '11438374798' # Chave PIX.\r\nNAME = 'John Doe' # Nome do dono do PIX.\r\nCITY = 'Sao Paulo' # Cidade do dono do PIX. Lembre-se de n\u00e3o usar acentos.\r\nVALUE = 10.00 # Valor da transa\u00e7\u00e3o.\r\nINDENTIFY = '12345678' # Indentificador da transa\u00e7\u00e3o (opcional).\r\n\r\nprint(Code(key=KEY, name=NAME, city=CITY, value=VALUE, identifier=INDENTIFY)) \r\n# 00020126330014BR.GOV.BCB.PIX011111438374798520400005303986540510.005802BR5908John Doe6009Sao Paulo621205081234567863046A00\r\n```\r\n\r\n### Indentificar e formatar chave PIX\r\n\r\nAutom\u00e1ticamente Indentifica o tipo de chave PIX e a formata.\r\n\r\n```python\r\nfrom pix_utils import Type\r\n\r\n\r\nprint(Type('11438374798')) # (CPF, '114.383.749-98')\r\nprint(Type('11991234567')) # (Phone, '(11) 99123-4567')\r\nprint(Type('06990590000123')) # (CNPJ, '06.990.590/0001-23')\r\nprint(Type('12345678-1234-1234-1234-123456789012')) # (Random, '12345678-1234-1234-1234-123456789012')\r\nprint(Type('example@example.com')) # (Email, example@example.com')\r\n```\r\n\r\nVoc\u00ea pode ver exemplos de usos [aqui](/examples)\r\n\r\n## Licen\u00e7a\r\n\r\n[MIT Licence](LICENSE)\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A module for useful functions related to the Brazilian payment system PIX.",
    "version": "1.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "0d4b4af2bffd530f6013f6fd0a722632",
                "sha256": "043a34b8ce67ebfab8732a93c224a8d3a645f20f2e96436e9680802d88e176af"
            },
            "downloads": -1,
            "filename": "pix-utils-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0d4b4af2bffd530f6013f6fd0a722632",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6806,
            "upload_time": "2022-12-21T17:52:34",
            "upload_time_iso_8601": "2022-12-21T17:52:34.801621Z",
            "url": "https://files.pythonhosted.org/packages/c7/6d/b5a7456799f1a57fbf54002c91ce952e00cd2c8696420d504774475c9d97/pix-utils-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-21 17:52:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Gustavosta",
    "github_project": "pix-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pix-utils"
}
        
Elapsed time: 0.04316s