be5a7b582e
Añade módulo Python con funciones para la API de Metabase en dominio infra. Incluye cliente HTTP, auth, y CRUD de cards, dashboards y users. Proyecto gestionado con uv (pyproject.toml).
1.3 KiB
1.3 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| metabase_auth | function | py | infra | 1.0.0 | impure | def metabase_auth(base_url: str, email: str, password: str) -> MetabaseClient | Autentica contra la API de Metabase con email y password. Retorna un MetabaseClient con session token valido por 14 dias. Endpoint: POST /api/session. |
|
false | error_go_core |
|
false | python/functions/metabase/client.py |
Ejemplo
from functions.metabase import metabase_auth
client = metabase_auth("http://localhost:3000", "admin@example.com", "pass")
# client listo para usar con todas las funciones CRUD
# Alternativa con API key:
from functions.metabase import MetabaseClient
client = MetabaseClient("http://localhost:3000", "mb_api_key_xxxxx")
Notas
Dos formas de obtener un client:
metabase_auth(): login con email/password, obtiene session token via POST /api/sessionMetabaseClient(base_url, api_key): constructor directo con API key (recomendado para automatizacion)
El client es un context manager: with metabase_auth(...) as client:
Errores comunes:
- 401: credenciales invalidas
- Rate limiting en intentos fallidos de login