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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8c4b87c95a5bed76b7c9b73bf24b56fcd4075f8937300ee60d00b184c0a98c2 |
|
MD5 | 6bd00fd3c7feba0fd2d041dee3eb18e3 |
|
BLAKE2b-256 | 20f2d93a4a7c7bfdab67dec353a1aad293de6d04c5870b33d76a18d0bb3d6781 |
Close
Hashes for playwright_har_tracer-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b2227e5b091cdde26747e186d76087ec00379927879ff91f83d97c481ed58cf |
|
MD5 | 09b092d10a7b695f2a0df6de17d7a4ca |
|
BLAKE2b-256 | dd55282bb05b223df56f89cf91cba69d16bed43628cd6e987a3641e3a891b122 |