Metadata-Version: 2.5
Name: mt2mx
Version: 1.0.0
Summary: Cliente oficial de Python para la API de MT2MX (SWIFT MT940/MT950 → ISO 20022 camt.053)
Project-URL: Homepage, https://mt2mx.cl
Project-URL: Documentation, https://mt2mx.cl/ayuda
Project-URL: Repository, https://mt2mx.cl
Author-email: TwercaLabs <rodrigo.orellana@twercalabs.cl>
License-Expression: MIT
Keywords: banking,camt.053,fintech,iso20022,mt940,mt950,swift
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.8
Requires-Dist: requests>=2.25
Description-Content-Type: text/markdown

# mt2mx

Cliente oficial de Python para [MT2MX](https://mt2mx.cl) — convierte mensajes SWIFT MT940/MT950 a ISO 20022 camt.053.

## Instalación

```bash
pip install mt2mx
```

## Uso

```python
from mt2mx import MT2MXClient

client = MT2MXClient("sk_live_TU_API_KEY")

xml = client.convert(mt940_message)  # consume 1 crédito de tu paquete

result = client.validate(mt940_message)  # gratis, no consume créditos
# {"valid": True, "format": "MT940", "detail": None}

info = client.me()
# {"client_id": "...", "credits_remaining": 87, "credits_expire_at": "..."}

historial = client.logs(limit=10)
```

El cliente maneja automáticamente la obtención y renovación del token de acceso — solo necesitas tu API key.

## Manejo de errores

```python
from mt2mx import MT2MXClient, MT2MXCreditsError, MT2MXAuthError, MT2MXAPIError

client = MT2MXClient("sk_live_TU_API_KEY")

try:
    xml = client.convert(mt940_message)
except MT2MXCreditsError:
    print("Paquete de conversiones agotado o vencido")
except MT2MXAuthError:
    print("API key inválida")
except MT2MXAPIError as e:
    print(f"Error {e.status_code}: {e.detail}")
```

## Documentación completa

https://mt2mx.cl/ayuda

## Licencia

MIT
