A Python implementation version of Playwright's HAR tracer
Project description
playwright-har-tracer
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())
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
Built Distribution
Close
Hashes for playwright-har-tracer-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92bb45891d3c6a8a83efe723fc6b7f16124000d3ce731a84082e4518312dc872 |
|
MD5 | 3c61577896c169e821003466f5adc326 |
|
BLAKE2b-256 | 6464e12fb1df98eb001ee69a6389ab05bddf29d04de17f943368b2ae9a9e2718 |
Close
Hashes for playwright_har_tracer-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0611067c26e43940d3e2000d1d3ce52e1a59e6b62b0447f1dd6fa9987d3f33 |
|
MD5 | f9f56fb16669ad47bc595daed1494298 |
|
BLAKE2b-256 | 682085c4fa3d77518ff13b133e4f405b96deebdf38ff8a8e64373efbe43c601b |