https://github.com/schemathesis/harfile
Writer for HTTP Archive (HAR) files
https://github.com/schemathesis/harfile
Last synced: 4 days ago
JSON representation
Writer for HTTP Archive (HAR) files
- Host: GitHub
- URL: https://github.com/schemathesis/harfile
- Owner: schemathesis
- License: mit
- Created: 2024-06-29T13:01:34.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-20T10:23:56.000Z (8 days ago)
- Last Synced: 2025-04-20T11:55:29.644Z (8 days ago)
- Language: Python
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# harfile
[](https://github.com/schemathesis/harfile/actions/workflows/ci.yml)
[](https://codecov.io/gh/schemathesis/harfile/branch/main)
[](https://pypi.org/project/harfile/)
[](https://pypi.org/project/harfile/)
[](https://opensource.org/licenses/MIT)This package provides a zero-dependency writer for building HAR (HTTP Archive) files in Python.
**NOTES**:
- The writer assumes a single-threaded environment.
- Pages are not supported.## Usage
```python
import datetime
import ioimport harfile
# Write to a file
with harfile.open("filename.har") as har:
har.add_entry(
startedDateTime=datetime.datetime.now(datetime.timezone.utc),
time=42,
request=harfile.Request(
method="GET",
url="http://example.com",
httpVersion="HTTP/1.1",
),
response=harfile.Response(
status=200,
statusText="OK",
httpVersion="HTTP/1.1",
),
timings=harfile.Timings(
send=0,
wait=0,
receive=0,
),
)# Write to a string buffer
buffer = io.StringIO()
with harfile.open(buffer) as har:
pass```
## License
The code in this project is licensed under [MIT license](https://opensource.org/licenses/MIT).
By contributing to `harfile`, you agree that your contributions will be licensed under its MIT license.