Skip to main content

WSGI routing library weasyprint plugin

Project description

Weasyprint plugin for wsgirouter3

Usage

Configure application to use plugin

def _generator(html_id: str, context: Any) -> str:
    # your choice of template engine


application = wsgirouter3.WsgiApp(router)
wsgirouter3_weasyprint.install(
    application,
    wsgirouter3_weasyprint.PdfConfig(html_generator=_generator)
)

Return instance of Pdf from endpoint

@router.get('/get', produces='application/pdf')
def get() -> Pdf:
    html_generation_ctx = {'context': 'variable'}
    return Pdf('html_template_id', html_generation_ctx)

Installation

$ pip install wsgirouter3_weasyprint

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

wsgirouter3_weasyprint-0.1.2.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

wsgirouter3_weasyprint-0.1.2-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

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