Bom dia
Não consigo verificar o status dos boletos através dessa api, podem me ajudar?
import requests
# Configurações da API do Efi Bank
CLIENT_ID = "seu_client_id"
CLIENT_SECRET = "seu_client_secret"
# URL para obter o token
TOKEN_URL = "https://api.efi.bank/open-banking/oauth/token"
# URL para buscar a lista de boletos
BOLETOS_URL = "https://api.efi.bank/open-banking/boleto/v1/boletos"
# Passo 1: Autenticação para obter o token de acesso
auth_data = {
"grant_type": "client_credentials",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET
}
token_response = requests.post(TOKEN_URL, data=auth_data)
token_json = token_response.json()
if "access_token" in token_json:
access_token = token_json["access_token"]
# Passo 2: Buscar todos os boletos
headers = {"Authorization": f"Bearer {access_token}"}
params = {"limit": 100} # Define a quantidade de boletos por requisição (máximo permitido pela API)
boleto_response = requests.get(BOLETOS_URL, headers=headers, params=params)
if boleto_response.status_code == 200:
boletos = boleto_response.json()["boletos"] # Lista de boletos retornados
# Exibir status de cada boleto
for boleto in boletos:
print(f"Boleto ID: {boleto['id']} - Status: {boleto['status']} - Cliente: {boleto['cliente']['nome']}")
else:
print("Erro ao buscar boletos:", boleto_response.json())
else:
print("Erro ao obter token de acesso:", token_json)