Skip to content

Commit 88dc632

Browse files
committed
docs: update
1 parent 2b2acb8 commit 88dc632

File tree

4 files changed

+13
-59
lines changed

4 files changed

+13
-59
lines changed

README.md

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Hario-Core: Modern HAR Parsing
22

33
[![PyPI version](https://badge.fury.io/py/hario-core.svg)](https://badge.fury.io/py/hario-core)
4-
[![Build Status](https://github.com/v-pikulev/hario-core/actions/workflows/python-package.yml/badge.svg)](https://github.com/v-pikulev/hario-core/actions/workflows/python-package.yml)
4+
[![Build Status](https://github.com/pikulev/hario-core/actions/workflows/python-package.yml/badge.svg)](https://github.com/pikulev/hario-core/actions/workflows/python-package.yml)
55
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
66

77
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.
@@ -40,44 +40,6 @@ for entry in results:
4040
print(entry["id"], entry["request"]["url"])
4141
```
4242

43-
## Why Normalize HAR Data?
44-
45-
HAR files from browsers or proxies sometimes contain negative values for sizes or timings (e.g., -1 for unknown). Normalization transforms these to zero, so you can safely compute totals, averages, and other metrics without skewing your analytics. This is especially important for dashboards, BI, and automated reporting.
46-
47-
## Why Deterministic IDs?
48-
49-
A deterministic ID is generated from key fields (like URL and timestamp), so the same logical request always gets the same ID—even if the HAR is re-exported or merged. This is essential for deduplication, change tracking, and building reliable analytics or data warehouses.
50-
51-
## Extending: Supporting Custom HAR Formats
52-
53-
You can use the built-in model for Chrome DevTools HAR extensions:
54-
55-
```python
56-
from hario_core.models.extensions.chrome_devtools import DevToolsEntry
57-
58-
# Suppose entry_json is a dict from a Chrome DevTools HAR entry
59-
entry = DevToolsEntry.model_validate(entry_json)
60-
print(entry.resourceType, entry.request.url)
61-
```
62-
63-
You can also register your own Pydantic models for browser-specific or proprietary HAR extensions:
64-
65-
```python
66-
from hario_core import register_entry_model
67-
from hario_core.models.har_1_2 import Entry
68-
from pydantic import Field
69-
70-
class SafariEntry(Entry):
71-
webkit_trace: dict = Field(alias="_webkitTrace")
72-
73-
def is_safari_entry(entry_json):
74-
return "_webkitTrace" in entry_json
75-
76-
register_entry_model(is_safari_entry, SafariEntry)
77-
```
78-
79-
> **Note:** The `_webkitTrace` field is not part of the official Safari HAR format. This example is for demonstration purposes only, showing how to extend the model for custom fields.
80-
8143
## Documentation
8244

8345
- [API Reference](docs/api.md)

docs/index.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
# Quickstart
2-
3-
```python
4-
from hario_core import parse, Pipeline, by_field, normalize_sizes, flatten
5-
6-
# Parse your HAR file (from path, bytes, or file-like object)
7-
har_log = parse("example.har")
8-
9-
# Build a processing pipeline: deterministic ID, normalization, flattening
10-
pipeline = Pipeline(
11-
id_fn=by_field(["request.url", "startedDateTime"]),
12-
transformers=[normalize_sizes(), flatten()],
13-
)
1+
# Hario Core
142

15-
results = pipeline.process(har_log)
16-
for entry in results:
17-
print(entry["id"], entry["request"]["url"])
18-
```
3+
Hario Core is a modern, extensible, and type-safe Python library for parsing, transforming, and analyzing HAR (HTTP Archive) files. Built on Pydantic, it provides robust validation, flexible transformation, and easy extension for custom HAR formats.
194

20-
---
5+
## Main Concepts
216

22-
# Hario Core
7+
- **Parser**: Use `parse()` to load and validate HAR files into Pydantic models (`HarLog`, `Entry`).
8+
- **Pipeline**: The `Pipeline` class lets you process HAR logs, assign IDs, and apply transformations in a composable way.
9+
- **Transformers**: Built-in and custom functions (like `flatten`, `normalize_sizes`, `normalize_timings`) to mutate or normalize HAR entries for storage or analytics.
10+
- **Utils**: Utilities for ID generation (`by_field`, `uuid`), model registration (`register_entry_model`), and more.
2311

24-
Hario Core is a modern, extensible, and type-safe Python library for parsing, transforming, and analyzing HAR (HTTP Archive) files. Built on Pydantic, it provides robust validation, flexible transformation, and easy extension for custom HAR formats.
12+
See the [API Reference](api.md) for detailed usage, signatures, and extension patterns.
2513

2614
## Key Features
2715

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ theme:
3030

3131
plugins:
3232
- search
33+
- autorefs:
34+
link_titles: auto
3335
- mkdocstrings:
3436
handlers:
3537
python:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dev = [
5050
"mkdocs==1.6.0",
5151
"mkdocs-material==9.5.26",
5252
"mkdocstrings[python]==0.25.1",
53+
"mkdocs-autorefs==0.5.0",
5354
]
5455

5556
[project.urls]
@@ -121,6 +122,7 @@ pytest-cov = "^6.1.1"
121122
mkdocs = "^1.6.0"
122123
mkdocs-material = "^9.5.26"
123124
mkdocstrings = {version = "^0.25.1", extras = ["python"]}
125+
mkdocs-autorefs = "^0.5.0"
124126

125127
[tool.poetry.urls]
126128
"Homepage" = "https://github.com/v-pikulev/hario"

0 commit comments

Comments
 (0)