February 2018
Beginner to intermediate
364 pages
10h 32m
English
Run the script for the recipe. The code in the script is the following:
from core.website_screenshot_generator import WebsiteScreenshotGeneratorfrom core.file_blob_writer import FileBlobWriterfrom os.path import expanduser# get the screenshotimage_bytes = WebsiteScreenshotGenerator().capture("http://espn.go.com", 500, 500).image_bytes# save it to a fileFileBlobWriter(expanduser("~")).write("website_screenshot.png", image_bytes)
A WebsiteScreenshotGenerator object is created, and then its capture method is called, passing the URL of the website to capture, and a desired width in pixels for the image.
This creates a Pillow image that can be accessed using the .image property, and the bytes for the image can be directly accessed ...
Read now
Unlock full access