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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cc1fcd3c5d750301aada363374a6cb3b715513c9d1fc1f698425487e6b9cafa |
|
MD5 | af5bd2090cee564f0c6d0bca44178ff6 |
|
BLAKE2b-256 | c243e5f1846cef01af86f9b6cf6f8df5e9a7082c527728bab3316830d77ba9fa |
Close
Hashes for playwright_har_tracer-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84dae14e1cc9b65ecd4b3e399b8b3a6abc5feb7352e731548f33eb596ee18f7d |
|
MD5 | 2f2d799b44d203ee95430afc6ba7425a |
|
BLAKE2b-256 | 286f5c2193632c6dd1ec98958f298498b2e8ba2aa6fa6586b5fcabc27a766e9e |