Skip to main content

Hario Core – Type-safe HAR Model & Transform

Project description

Hario Core — Type-safe HAR Model & Transform

PyPI version Build Status Code style: black codecov

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., flattening, normalization).
  • 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

from hario_core import parse, Pipeline, by_field, normalize_sizes, flatten

# Build a processing pipeline: deterministic ID, normalization, flattening
pipeline = Pipeline(
    id_fn=by_field(["request.url", "startedDateTime"]),
    transformers=[normalize_sizes(), flatten()],
)

# Parse your HAR file (from path, bytes, or file-like object)
model = parse("example.har")
result_dict = pipeline.process(model)

for entry in result_dict:
    print(entry["id"], entry["request"]["url"])

Documentation

License

MIT License. See LICENSE.

Supported Python Versions

  • Python 3.10+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hario_core-0.3.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hario_core-0.3.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file hario_core-0.3.0.tar.gz.

File metadata

  • Download URL: hario_core-0.3.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Darwin/23.6.0

File hashes

Hashes for hario_core-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f8b738f936ceb28b4ff83055e6e09737d337287f2e74da75da2611572d60f207
MD5 f2a38b0938f643773f3029e030a15d56
BLAKE2b-256 e9952400dae8dc4da4a5f0ccfcbf7442eab7903a08e697403cdd18905ad960aa

See more details on using hashes here.

File details

Details for the file hario_core-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hario_core-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.11 Darwin/23.6.0

File hashes

Hashes for hario_core-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8c8e06ec3b2da2cd9ae6bb938127dd5c7b3976606af1a1d9075ee4a790002a6
MD5 537020f79f4acdb7e975c0566a3d3ecc
BLAKE2b-256 2914ed06f541c80c94c9c9fdf36247560687efd294b5c57a7e405c3c802468da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page