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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2807a766e98116102d2d1f0ca13cf4d9aa26e1204701e9a2c96a56cdf6884ca9 |
|
MD5 | 77feec241ad6019d928f0b0c2f271d05 |
|
BLAKE2b-256 | c416aa9645298b03e3943d4e2906ab7b99f7f661bdccf4829d2f0d6414fdfeca |
Close
Hashes for playwright_har_tracer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 870aa3e42c1f66a5af378fcb1aa3cc4b6b10be5a56ef324766e35472a2bee113 |
|
MD5 | 4b812d40e3e80e7562418eb09ff0e3ae |
|
BLAKE2b-256 | 1208c4dcca08da306c62c23f314c1234da36d8a7d35be99f46191bdee15404a8 |