Skip to main content

Playwright APIRequest builder

Project description

:performing_arts: Playwright APIRequest builder

Checked with mypy Code style: black Imports: isort

Documented

Read it here :link: documentation
Read more about the builder pattern on :link: refactoring.guru

Example

# sync example
from playwright.sync_api import sync_playwright
from playwright_request.sync_builder import RequestBuilder

with sync_playwright() as p:
    builder = RequestBuilder(p, base_url='https://playwright.dev/')
    request = builder.get("python/docs/intro").create_request()
    response = request()
    print(response.text())
# async example
import asyncio
from playwright.async_api import async_playwright
from playwright_request.async_builder import RequestBuilder

async def main():
    async with async_playwright() as p:
        builder = RequestBuilder(p, base_url='https://playwright.dev/')
        request = builder.get("python/docs/intro").create_request()
        response = await request()
        print(await response.text())

asyncio.run(main())

Requirements

Python3
Playwright >= 1.26.0

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

playwright-apirequest-builder-1.0.0.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page