Commit 9df1a323 authored by Christophe Benz's avatar Christophe Benz
Browse files

Tweak log messages, use JSON

parent f05cc310
"""PDF report rendering utilities."""
import json
from abc import ABC, abstractmethod
import logging
......@@ -32,12 +33,11 @@ class BrowserlessPDFRenderer(PDFRenderer):
"""Browserless IO implementation."""
def __init__(self, api_url: str, api_token: str):'BrowserlessPDFRenderer(%s,XXX)', api_url)"BrowserlessPDFRenderer: creating instance with api_url = %r", api_url)
self.api_url = api_url
self.api_token = api_token
def render(self, url: str):"BrowserlessPDFRenderer.render(%s)", url)
headers = {
"Cache-Control": "no-cache",
"Content-Type": "application/json",
......@@ -51,12 +51,18 @@ class BrowserlessPDFRenderer(PDFRenderer):
"format": "A4",
}"BrowserlessPDFRenderer.render data = %r", data)
"BrowserlessPDFRenderer.render: about to send a POST request to "
"browserless with data = %r and headers = %r",
# Request server"BrowserlessPDFRenderer.render before post")
r =, headers=headers, params=params, json=data)"BrowserlessPDFRenderer.render after post")
r.raise_for_status()"BrowserlessPDFRenderer.render content size = %d", len(r.content))
"BrowserlessPDFRenderer.render: received response, content size = %d",
return r.content
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment