The api Module

Standard-library-only Apache Superset REST API client.

No third-party dependencies. Auth: POST /api/v1/security/login returns a JWT; the import endpoint also needs the CSRF token (GET /api/v1/security/csrf_token/) and a Referer header.

multipart(fields, files)[source]

fields: dict[str,str]; files: list[(name, filename, bytes, ctype)].

class SupersetClient(base_url)[source]
login(username, password)[source]
get_database_uuid(name)[source]

Resolve a connection NAME to its uuid on THIS Superset instance.

Each instance assigns its own uuid, so callers must look it up by name rather than hard-code it.

export_dashboard(dashboard_id)[source]

Return the native bundle (zip bytes) for one dashboard id.

import_dashboard_zip(zip_bytes, overwrite=True)[source]

POST a native bundle to the v1 importer (same code the UI uses; the legacy superset import-dashboards CLI silently drops charts from native bundles). Returns (http_status, body_text).

list_all(kind)[source]

kind in {chart, dataset, dashboard}: return every result dict (paginated).

dashboard_charts(dashboard_id)[source]

Charts that BELONG to a dashboard (m2m relationship), as result dicts with ids. Resolves charts precisely per dashboard, so copies of a dashboard that share chart names are not confused with each other.

bulk_delete(kind, ids)[source]

Delete many objects of one kind in a single request.