Tools to Capture and Convert the Web

Take Website Screenshots with Python Screenshot API

Python API
The diagnostics panel can help you debug your code!

GrabzIt's screenshot API provides great flexibility and users can call it from a cronjob, a web page, or an app. The easiest way to add website screenshots or converting HTML to images, PDF and DOCX, to your Python app is by following these steps:

  1. Get your free key and secret.
  2. Download the free Python Library manually or via pip install and try out the demo app.
  3. Learn the basics about how GrabzIt's API works by reading the below overview.

Python API Overview

To use the API, you will first need to create an instance of the GrabzItClient class. Then pass your key and secret from your GrabzIt account to the constructor.

from GrabzIt import GrabzItClient

# Create the GrabzItClient class
# Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

Next you will need to use one of the image, PDF, animation or table methods. To request that the GrabzIt service capture the URL passed to it. Or convert HTML into an image, JPG or DOCX file.

# To take a image screenshot
# Or to take a PDF screenshot
# Or to convert online videos into animated GIF's
# Or to capture table(s)
# To convert HTML into a image
grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>")	
# Or convert HTML into a PDF document
grabzIt.HTMLToPDF("<html><body><h1>Hello World!</h1></body></html>")
# Or convert HTML into a CSV, XLSX or JSON document
# To convert HTML file into a image
# Or convert HTML file into a PDF document
# Or convert HTML file into a CSV, XLSX or JSON document

You must use one of the two following save methods to retrieve the capture. The recommended Save method requires the URL of a handler such as This enables the capture to be retrieved asynchronously. This stops your app having to wait while a screenshot is created, and because it eliminates the need to repeatedly poll GrabzIt could potentially be faster.

Always use the SaveTo method on localhost

The other save method is the synchonous SaveTo method, while this is simpler to use. It will force your app to wait while the screenshot is created.

So it should only be used in situations were the Save method cannot be used, such as in a desktop application or on localhost.

filepath = "images/result.jpg"

More Options

There are many more options when screenshots from web pages or converting HTML. Including; configuring the browser height and width, screenshot height and width. The delay before a capture is taken and the format of the capture. Find all these options and much more in the GrabzIt Client documentation.