How to use the imgkit.from_string function in imgkit

To help you get started, we’ve selected a few imgkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buffer / thug / thug / Analysis / screenshot / Screenshot.py View on Github external
continue # pragma: no cover

            norm_src = log.HTTPSession.normalize_url(window, src)
            if norm_src:
                img['src'] = norm_src

        content = soup.prettify(formatter = None)
        options = {
            'quiet' : ''
        }

        if sys.platform in ('linux', ):
            options['xvfb'] = ''

        try: # pragma: no cover
            screenshot = imgkit.from_string(content, False, options = options)
            log.ThugLogging.log_screenshot(url, screenshot)
        except Exception as e:
            log.warning("[SCREENSHOT] Error: %s", str(e))