Repository navigation
v0.2.0 — 2FA support
Highlights
PPI started requiring 2FA, which broke __init__ for accounts with email-based second factor. This release adds proper 2FA handling so the library can authenticate again.
What's new
- New
otp_providerparameter onPPI(...)— pass anyCallable[[], str]returning the 6-digit code (callback, IMAP poller, prompt, etc.). Falls back toinput()when not provided. - New
remember_deviceparameter (defaultFalse) forwarded to PPI'srecordarfield. - Resolves the user's
cuentaIDfrom the JWT claimPPAuth.Claims.General.Cuentaswhen/api/Cuenta/ComitentesAsignadosis not available for the account. - Cleaner error messages in
api_request— 401s now raiseApiExceptionwith the actual server response instead of being silently swallowed; 4xx/5xx no longer collapse into a genericBad HTTP API Response.
Usage
from py_ppi_arg import PPI
# Interactive (prompts in console for the code):
app = PPI(user="...", password="...")
# Programmatic with callback:
app = PPI(user="...", password="...", otp_provider=lambda: input("OTP: "))Known limitations
- Account-context endpoints
get_tickers_listand the underlying/api/Ordenes/InstrumentosOperablesmay return 401 depending on the role/permissions PPI assigns to the account, regardless of thecuentaIDvalue passed. Market-data endpoints (search_tickers,get_technical_data_bonds,get_historic_data,get_intraday_data) work correctly.
Backwards compatibility
All new parameters have defaults, so existing call sites without 2FA on the account continue to work unchanged.