Skip to main content

playwright-har-tracer

PyPI version Python CI Coverage Status

A Python implementation version of Playwright's HAR tracer. It is equivalent to playwright v0.13.x’s HAR tracer implementation.

Motivation

Playwright's HAR tracer is implemented to generate HAR as a file. I need to get HAR as a Python object rather than a file.

  • playwright-har-tracer's HarTracer generates HAR as a dataclass object.

⚠️ Limitations

  • Tested with Python 3.8+
  • Tested with Chromium only
  • Supports the async API only

Installation

pip install playwright-har-tracer

Usage

import asyncio
from playwright.async_api import async_playwright
from playwright_har_tracer import HarTracer


async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        context = await browser.new_context()

        tracer = HarTracer(context=context, browser_name=p.chromium.name)

        page = await context.new_page()

        await page.goto("http://whatsmyuseragent.org/")

        har = await tracer.flush()

        await context.close()
        await browser.close()

    print(har.to_json())


asyncio.run(main())

Metadata

Release files for playwright-har-tracer 0.3.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 playwright-har-tracer 0.3.2
File Size Uploaded
playwright-har-tracer-0.3.2.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for playwright-har-tracer 0.3.2
File Interpreter ABI Platform
playwright_har_tracer-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / playwright-har-tracer-0.3.2.tar.gz

Download URL playwright-har-tracer-0.3.2.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0cf133ae1716e0d2e927623e31bf7883f9de944c7ffbd7ac149825e3f6e825c4
BLAKE2b-256 checksum
How to use checksums
3bbe5766003ec3e4d2f4a9bb9c05bea0519d2b9aacb8f9b276ee01e39d361713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.6 Darwin/21.2.0

Release files / playwright_har_tracer-0.3.2-py3-none-any.whl

Download URL playwright_har_tracer-0.3.2-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1f826261ee72910a835eb7274edbb75526b83128ab4a565d08a36603c22400d
BLAKE2b-256 checksum
How to use checksums
58434cfe96005623e21d8b511908ea1cf902ff8c39e0af9e48a41df76ed68d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.8.6 Darwin/21.2.0

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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