Skip to main content

Hario Core — Type-safe HAR Model & Transform

PyPI version Build Status Code style: black codecov Ask DeepWiki

A modern, extensible, and type-safe Python library for parsing, transforming, and analyzing HAR (HTTP Archive) files. Built on Pydantic, Hario-Core provides robust validation, flexible transformation, and easy extension for custom HAR formats.

Features

  • Type-Safe Parsing: Validates HAR files using Pydantic models, catching errors early.
  • Transformers: Apply built-in or custom transformations to each HAR entry (e.g., flatten, normalizations).
  • Normalization: Ensures all numeric fields (sizes, timings) are non-negative, so you can safely sum, aggregate, and analyze data without errors from negative values. This is crucial for analytics and reporting.
  • Deterministic & Random IDs: Generate unique or deterministic IDs for each entry. Deterministic IDs ensure that the same request always gets the same ID—useful for deduplication, comparison, and building analytics pipelines.
  • Extensible: Register your own entry models to support browser-specific or proprietary HAR extensions (e.g., Chrome DevTools, Safari).
  • Composable Pipelines: Chain any number of transformers and ID strategies for flexible data processing.

Installation

pip install hario-core

Quickstart

1. Parse and validate a HAR file

from hario_core.parse import parse

har_log = parse("example.har")
entries = har_log.model_dump()["entries"]  # list of dicts

2. Transform entries with a pipeline

from hario_core.transform import Pipeline, flatten, set_id, by_field

pipeline = Pipeline([
    set_id(by_field(["request.url", "startedDateTime"]))
])
results = pipeline.process(entries)

3. Custom entry models (extensions)

from hario_core.parse import register_entry_model
from hario_core.models import Entry

def is_custom_entry(entry: dict) -> bool:
    return "x-custom" in entry

class CustomEntry(Entry):
    x_custom: str

register_entry_model(is_custom_entry, CustomEntry)

Public API

Parsing and validation

  • parse(path_or_bytes_or_filelike) -> HarLog
  • validate(har_dict: dict) -> HarLog
  • register_entry_model(detector: Callable, model: Type[Entry])
  • entry_selector(entry_dict: dict) -> Type[Entry]

Models

  • Entry, HarLog, DevToolsEntry (and all standard HAR 1.2 models)

Transform

  • Pipeline, flatten, normalize_sizes, normalize_timings, set_id, by_field, uuid, json_array_handler

Documentation

License

MIT License. See LICENSE.

Supported Python Versions

  • Python 3.10+

Metadata

Release files for hario-core 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hario-core 0.4.2
File Size Uploaded
hario_core-0.4.2.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hario-core 0.4.2
File Interpreter ABI Platform
hario_core-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / hario_core-0.4.2.tar.gz

Download URL hario_core-0.4.2.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ebfd9897ae7839e4f5b1899eeb1f4b6be47d9cef9c9db5316f2d8507a61a19e2
BLAKE2b-256 checksum
How to use checksums
b7821837e4d94cfaa757c887b633a0e1a260b92bfcf0ef8b136daac37a9e095e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.18 Darwin/23.6.0

Release files / hario_core-0.4.2-py3-none-any.whl

Download URL hario_core-0.4.2-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8671d15105ec1abdfc9136170c926a94f4ba73c343916240d7275f14222fb069
BLAKE2b-256 checksum
How to use checksums
5f58956b0df9bd64c9eebb7abd418ab9e7a0fd9bfa3eea246bd5501c2444520b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.18 Darwin/23.6.0

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page