Unofficial Laboral Kutxa Python library
pip install laboral-kutxa
Reading through the misProductos
list:
import os
from laboralkutxa.api import login, get_my_products
username = os.environ.get("USERNAME")
password = os.environ.get("PASSWORD")
login_response = login(username, password)
token = login_response["token"]
products = get_my_products(token)
print(
[
{"alias": product["alias"], "grupo": product["grupo"]}
for product in products["misProductos"]
]
)
Output:
[
{'alias': 'CUENTA 0,0', 'grupo': 'cuentasCorrientes'},
{'alias': 'VISA ELECTRÓN', 'grupo': 'tarjetas'},
{'alias': 'PRESTAMO', 'grupo': 'prestamos'}
]
Accessing the aggregated amounts per account types:
products = get_my_products(token)
current_account = products["_Importes"]["_CuentasCorrientes"]
financing = products["_Importes"]["_Financiacion"]
print({"currentAccount": current_account, "financing": financing})
Output:
{
'currentAccount': {'cantidad': 4440.13, 'moneda': 'EUR'},
'financing': {'cantidad': 174356.48, 'moneda': 'EUR'}
}
There's also a command line interface available, try with:
laboralkutxa --help