From 41a1b4cd2bc7d933199c4ae48d65b6190e96aea0 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Sat, 2 May 2020 10:33:51 +0200 Subject: [PATCH] a little profiling to sort our why we don't download images --- screenless/bureau/bureau.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 008ff71..a3e2f1f 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -386,7 +386,13 @@ class Bureau(object): # use an URL fetcher that waits 30s instead of 10s def slowfetch(url, timeout=30, ssl_context=None): - return weasyprint.default_url_fetcher(url, 30, ssl_context) + print("fetching", url) + import time + start = time.time() + ret = weasyprint.default_url_fetcher(url, 30, ssl_context) + elapsed = time.time() - start + print("fetched", url, "in", elapsed) + return ret weasyprint.HTML(url_fetcher=slowfetch, string=templ.render_unicode(**kwargs)).write_pdf(pdfpath)