A Python implementation version of Playwright's HAR tracer
Project description
playwright-har-tracer
A Python implementation version of Playwright's HAR tracer.
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.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f7443a3e3c31ba97def5c7d46013620b43fab0ed383a35dbc32adbbb3b75add |
|
MD5 | dbbb364ef2f6a9b9513405e505bddad3 |
|
BLAKE2b-256 | 1af2093019eb0ad09ae2cf3b90bedc49a7a0b737f80a391968e35056d2646d04 |
Close
Hashes for playwright_har_tracer-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b35d61127b74ed5ac504e6403129c19896481c84ff0a8edd69ddeaa0b4732fd6 |
|
MD5 | 6973995653a14a75f1b1c8b633429352 |
|
BLAKE2b-256 | f6dea7a0a06577d9b86f6f9da61b1b02fecd1769fc68ae2d5fd9ba923e17fe12 |