|
|
@ -461,21 +461,12 @@ class Bureau(object):
|
|
|
|
|
|
|
|
|
|
|
|
# use an URL fetcher that waits 30s instead of 10s
|
|
|
|
# use an URL fetcher that waits 30s instead of 10s
|
|
|
|
def slowfetch(url, timeout=30, ssl_context=None):
|
|
|
|
def slowfetch(url, timeout=30, ssl_context=None):
|
|
|
|
if len(url) < 50:
|
|
|
|
|
|
|
|
print("fetching", url)
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
start = time.time()
|
|
|
|
|
|
|
|
ret = weasyprint.default_url_fetcher(url, 30, ssl_context)
|
|
|
|
ret = weasyprint.default_url_fetcher(url, 30, ssl_context)
|
|
|
|
elapsed = time.time() - start
|
|
|
|
|
|
|
|
if len(url) < 50:
|
|
|
|
|
|
|
|
print("fetched", url, "in", elapsed)
|
|
|
|
|
|
|
|
return ret
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
|
|
html_rendered = weasyprint.HTML(url_fetcher=slowfetch,
|
|
|
|
html_rendered = weasyprint.HTML(url_fetcher=slowfetch,
|
|
|
|
string=templ.render_unicode(**kwargs))
|
|
|
|
string=templ.render_unicode(**kwargs))
|
|
|
|
|
|
|
|
|
|
|
|
print("log level:", str(self.log.getEffectiveLevel()))
|
|
|
|
|
|
|
|
print("config:", self.config)
|
|
|
|
|
|
|
|
if self.log.getEffectiveLevel() == logging.DEBUG:
|
|
|
|
if self.log.getEffectiveLevel() == logging.DEBUG:
|
|
|
|
with open("/tmp/debug.html", "w") as html_out:
|
|
|
|
with open("/tmp/debug.html", "w") as html_out:
|
|
|
|
html_out.write(templ.render_unicode(**kwargs))
|
|
|
|
html_out.write(templ.render_unicode(**kwargs))
|
|
|
|