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
Nonequando 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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ae2effb382c11c1fed70e9d4175d2c4f31043f5f8ebe8daf119ec75ae2309a2
|
|
| MD5 |
efd383010a270d81103c3800157fdb0b
|
|
| BLAKE2b-256 |
6d5915cc25fa7b8642844b5c1679a5b50d37fc1f195b18a90bfa07878fe5a8d4
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f46dc56a502a751b9a8e9de67d3097d84a6d3c9423f1a09223974b1de94be1
|
|
| MD5 |
008e94314675d65e8c68aea668cd1ff2
|
|
| BLAKE2b-256 |
8a3acaf8132e1f339804d873801fe2e1c3a091bb54df1fda406a0432d188369e
|