Skip to content

ONC Common Helpers

STATUS_PREFIX = {'INFO': 'ℹ️ ', 'SUCCESS': '✅ ', 'WARNING': '⚠️ ', 'ERROR': '❌ ', 'PROGRESS': '🔄 '} module-attribute

ensure_timezone_aware(dt_obj, tz=timezone.utc)

Convert timezone-naive datetime to timezone-aware datetime (and normalize to tz).

Also handles date objects by converting them to datetime at midnight.

format_iso_utc(dt_obj)

Format datetime as ONC-compatible ISO UTC string.

load_config(data_dir_override=None)

Load ONC token and data directory from environment/.env.

print_status(message, level='INFO')

Print a status message with level indicator.

start_and_end_strings(start_date_object, time_delta)

Calculate end date and return formatted start/end strings.