Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def screenshot(url, force=False):
path = files.screenshot_path(url)
if not os.path.exists(path):
driver = webdriver.PhantomJS()
driver.set_window_size(1024, 768)
driver.get(url)
driver.save_screenshot(path)
files.square_crop(path)
files.thumbnail(path)
return path
#print "Screenshot saved to: ",filepath