Skip to main content

A Python SDK for Sicoob API

Project description

Sicoob SDK Python

SDK Python para integração com a API do Banco Sicoob

Instalação

pip install -r requirements.txt
# ou
pip install -e .

Configuração

Crie um arquivo .env na raiz do projeto com as seguintes variáveis:

SICOOB_CLIENT_ID=seu_client_id
SICOOB_CLIENT_SECRET=seu_client_secret
SICOOB_CERTIFICADO=caminho/para/certificado.pem
SICOOB_CHAVE_PRIVADA=caminho/para/chave_privada.key

Uso Básico

from sicoob import Sicoob

# Inicializa o cliente
cliente = Sicoob(
    client_id="seu_client_id",
    client_secret="seu_client_secret",
    certificado="caminho/para/certificado.pem",
    chave_privada="caminho/para/chave_privada.key"
)

# Exemplo: consulta de extratos
extrato = cliente.consulta_extrato(conta="12345", data_inicio="2023-01-01", data_fim="2023-01-31")

API de Boletos

A classe BoletoAPI permite emitir e consultar boletos bancários:

from sicoob.boleto import BoletoAPI

# Obtém instância do BoletoAPI
boleto_api = cliente.boleto()

# Emitir boleto
dados_boleto = {
    "numeroContrato": 123456,
    "modalidade": 1,
    "valor": 100.50,
    "beneficiario": {
        "nome": "Nome Beneficiário",
        "documento": "12345678901"
    }
}
boleto = boleto_api.emitir_boleto(dados_boleto)

# Consultar boleto
nosso_numero = boleto["nossoNumero"]
boleto_consultado = boleto_api.consultar_boleto(nosso_numero)

Tratamento de Erros

A API trata os seguintes casos de erro:

  • 404 Not Found: Retorna None quando o boleto não existe
  • Erros HTTP (400, 500, etc): Levanta exceção com código e mensagem
  • Erros de conexão: Levanta exceção com detalhes do erro

Links Úteis

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

sicoob_sdk-0.1.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sicoob_sdk-0.1.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file sicoob_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: sicoob_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for sicoob_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ae2effb382c11c1fed70e9d4175d2c4f31043f5f8ebe8daf119ec75ae2309a2
MD5 efd383010a270d81103c3800157fdb0b
BLAKE2b-256 6d5915cc25fa7b8642844b5c1679a5b50d37fc1f195b18a90bfa07878fe5a8d4

See more details on using hashes here.

File details

Details for the file sicoob_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sicoob_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for sicoob_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91f46dc56a502a751b9a8e9de67d3097d84a6d3c9423f1a09223974b1de94be1
MD5 008e94314675d65e8c68aea668cd1ff2
BLAKE2b-256 8a3acaf8132e1f339804d873801fe2e1c3a091bb54df1fda406a0432d188369e

See more details on using hashes here.

Supported by

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