Huwise Utils Python
A modern, type-safe Python library for the Huwise Automation API.
Features
- Type-safe configuration with Pydantic-based
HuwiseConfig - Object-oriented API with
HuwiseDatasetclass and method chaining - Async support for high-performance bulk operations
- Airflow-friendly logging via Python stdlib logging
- Dependency injection support for testable code
- Backwards compatible function-based API
Installation
Quick Start
Using the HuwiseDataset Class (Recommended)
from huwise_utils_py import HuwiseDataset
# Create a dataset instance from its ID
dataset = HuwiseDataset.from_id("100123")
# Read metadata
title = dataset.get_title()
description = dataset.get_description()
# Update metadata with method chaining
dataset.set_title("New Title", publish=False).set_description("New description").publish()
Using the Function-based API
from huwise_utils_py import get_dataset_title, set_dataset_title
# Read metadata
title = get_dataset_title(dataset_id="100123")
# Update metadata
set_dataset_title("New Title", dataset_id="100123")
Configuration
Set up your environment variables:
The default domain is data.bs.ch. For other portals, set:
Or use a .env file:
API Reference
This library is a Python client for the Huwise Automation API. The Automation API enables programmatic management of:
- Datasets - Create, update, publish, and delete datasets
- Metadata - Manage dataset metadata across templates (default, visualization, internal, custom)
- Resources - Upload, update, and manage data sources (CSV, JSON, HTTP, FTP, etc.)
- Security - Configure access rules for users and groups
- Fields - Define field types, descriptions, and annotations
- Attachments - Manage supplementary files
For the complete API specification, see the official Automation API documentation.
Related Projects
- odsAutomationR - An R package for accessing the Automation API, developed by the Canton of Thurgau. If you're working in R, this package provides similar functionality.
Note on Previous Package
This package replaces the archived ods-utils-py repository. If you're migrating from the old package, see the Migration Guide for details on the changes.