]> git.aero2k.de Git - sirius.git/commitdiff
Disable every and all security when rendering HTML via phantomjs.
authorTom Hunger <tehunger@gmail.com>
Thu, 22 Jan 2015 17:12:04 +0000 (17:12 +0000)
committerTom Hunger <tehunger@gmail.com>
Thu, 22 Jan 2015 17:12:04 +0000 (17:12 +0000)
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

index 57cdb5d534b729e59cd5c6558ea4f3fe392e94c8..cadc3bf672200128410a48e4f9e9189badd59483 100644 (file)
@@ -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