From 8b93d242a9dbefa558379adcec5e73caf6faed48 Mon Sep 17 00:00:00 2001 From: Tom Hunger Date: Thu, 22 Jan 2015 17:12:04 +0000 Subject: [PATCH] Disable every and all security when rendering HTML via phantomjs. We're not protecting a user's logged in session or private information, we're using phantomjs to render publicly available content so we don't really care whether a website's certificate checks out, or whether the SSL version is older than the cambrian explosion. --- sirius/coding/image_encoding.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sirius/coding/image_encoding.py b/sirius/coding/image_encoding.py index 57cdb5d..cadc3bf 100644 --- a/sirius/coding/image_encoding.py +++ b/sirius/coding/image_encoding.py @@ -100,7 +100,10 @@ def html_to_png(html): """ from selenium import webdriver try: - driver = webdriver.PhantomJS('phantomjs') + caps = {'acceptSslCerts': True} + driver = webdriver.PhantomJS( + 'phantomjs', desired_capabilities=caps, + service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any']) driver.set_window_size(384, 5) # note that the .html suffix is required to make phantomjs -- 2.47.3